template <class T>
class vallocator:public std::allocator<T>
{
pointer allocate(size_type _Count)
{
return CoTaskMemAlloc(_Count);
}
void deallocate(pointer _Ptr, size_type)
{
CoTaskMemFree(_Ptr);
}
};
class shared_tree_node
{
//shared_tree_node(){};
public:
static shared_tree_node * CreateInstance() { return (shared_tree_node*)CoTaskMemAlloc(sizeof(shared_tree_node));};
std::vector<shared_tree_node,vallocator<shared_tree_node> > childs;
//std::basic_string< wchar_t,std::char_traits<wchar_t>,vallocator<wchar_t> > name;
shared_tree_node * AddChild(LPWSTR nm)
{
shared_tree_node nd;
//nd.name = name;
ругается здеся childs.push_back(std::vector<shared_tree_node,vallocator<shared_tree_node> >::value_type(nd));
//return &(*(childs.end()-1));
}
};
ошибка такая Error 3 error C2664: 'std::_Vector_val<_Ty,_Alloc>::_Vector_val(_Alloc)' : cannot convert parameter 1 from 'const std::allocator<_Ty>' to 'vallocator<T>' c:\program files\microsoft visual studio 8\vc\include\vector 487
не понимаю , вроде аллокатор я ему подсунул в качестве параметра шаблона , че он там конвертить то еще хочет ?