Re: [問題] template一問
※ 引述《developers (alpine skier)》之銘言:
: template<class T>
: Base* Get()
: {
: return new T;
: }
: template<>
: Base* Get<D1>()
: {
: return new D1;
: }
: template<>
: Base* Get<D2>()
: {
: return new D2;
: }
: template<>
: Base* Get<D3>()
: {
: return new D3;
: }
請問template中如果使用 new 時,讓此 template 變成dll後
會不會發生 new, delete 使用的 c++ runtime 版本不合的問題呢?
a.cpp:
Base* a_instance=Get<Type1>(); //使用a.cpp 中的runtime去 new
Release(a_instance); //使用template library dll中的runtime 去delete
//new, delete 使用的版本不同,可能發生問題?
thanks~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.193.31.42
推
06/19 00:23, , 1F
06/19 00:23, 1F
→
06/19 00:25, , 2F
06/19 00:25, 2F
→
06/19 00:26, , 3F
06/19 00:26, 3F
→
06/19 00:27, , 4F
06/19 00:27, 4F
→
06/19 00:28, , 5F
06/19 00:28, 5F
→
06/19 00:47, , 6F
06/19 00:47, 6F
討論串 (同標題文章)