> d:\stl\defalloc.h(124) : error C2660: 'new' : function does not take
> 2 parameters
請問您有overload new(new_initializer, placement)
這個operator嗎?
> [33;1mtemplate <class T1, class T2>
> inline void construct(T1* p, const T2& value) {
> new (p) T1(value); [34m // 錯誤訊息指到這一行 [33m
> }
> [0m
依您的原意, 寫成 p=new T1(value); 應該就可以了...
不然就得要overload new 這個operator.
根據Stroustrup "THE C++ PROGRAMMING LANGUAGE SECOND EDITION" r.5.3.3:
"allocation-expression:
:: new placement new-type-name new-initializer
... [刪去]
The placement syntax can be used to supply additional arguments.
For example, new T results in a call of operator new(sizeof(T))
and new (2,f) T results in a call operator new (sizeof(T), 2, f)"
請各位前輩指正.
--
* Origin: ★ 交通大學資訊科學系 BBS ★ <bbs.cis.nctu.edu.tw: 140.113.23.3>