RE: [Boost-Users] simplest pool_alloc example does not work on VC 6

John - Sorry, Boost.Pool does not currently support MSVC, due to that compiler's extreme lack of template support. -Steve
-----Original Message----- From: John Harris [mailto:john.harris@tradingtechnologies.com]
Using Boost 1.30.0. MSVC6 Tow problems: (1) I have to #define __WIN32__, and (2) Doesn't compile

sjc> Sorry, Boost.Pool does not currently support MSVC, due to that compiler's sjc> extreme lack of template support. It works with STLPort(www.stlport.com). On VC 6 you must define 2 helper functions __stl_alloc_create and __stl_alloc_rebind in namespace std. Some thing like that namespace std { template <class _Tp1, class _Tp2, class _Tp3, class _Mtx> inline boost::pool_allocator<_Tp2, _Tp3, _Mtx>& _STLP_CALL __stl_alloc_rebind(boost::pool_allocator<_Tp1, _Tp3, _Mtx>& __a, const _Tp2*) { return (boost::pool_allocator<_Tp2, _Tp3, _Mtx>&)(__a); } template <class _Tp1, class _Tp2, class _Tp3, class _Mtx> inline boost::pool_allocator<_Tp2, _Tp3, _Mtx> _STLP_CALL __stl_alloc_create(const boost::pool_allocator<_Tp1, _Tp3, _Mtx>&, const _Tp2*) { return boost::pool_allocator<_Tp2, _Tp3, _Mtx>(); } } On VC7 work without helper functions -Ilya

--- In Boost-Users@yahoogroups.com, scleary@j... wrote:
John -
Sorry, Boost.Pool does not currently support MSVC, due to that compiler's extreme lack of template support.
I also tried this on the real released VC7.1 (which has been on MSDN subscriber downloads for a couple of weeks, now), and, while it compiles, I get warnings that point me to some code that looks like it's losing precision (size_type reduced to bool) in a calculation. The code: typedef int t; std::map<t, t, std::less<t>, boost::pool_allocator<std::pair<const t, t> > > m; The pool code about which the following warnings complain: const size_type num_chunks = total_req_size / partition_size + static_cast<bool>(total_req_size % partition_size); The warnings: d:\tt-dev\misc\boost\1_30_0\dev\boost\pool\pool.hpp(267) : warning C4800: 'const boost::pool<UserAllocator>::size_type' : forcing value to bool 'true' or 'false' (performance warning) with [ UserAllocator=boost::default_user_allocator_new_delete ] d:\tt-dev\misc\boost\1_30_0\dev\boost\pool\pool.hpp(263) : while compiling class-template member function 'void boost::pool<UserAllocator>::ordered_free(void *const ,const boost::pool<UserAllocator>::size_type)' with [ UserAllocator=boost::default_user_allocator_new_delete ] d:\tt-dev\misc\boost\1_30_0\dev\boost\pool\pool_alloc.hpp (49) : see reference to class template instantiation 'boost::pool<UserAllocator>' being compiled with [ UserAllocator=boost::default_user_allocator_new_delete ] c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\map(23) : see reference to class template instantiation 'boost::pool_allocator<T>' being compiled with [ T=std::pair<const t,t> ] c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xtree(23) : see reference to class template instantiation 'std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,_Mfl>' being compiled with [ _Kty=t, _Ty=t, _Pr=std::less<t>, _Alloc=boost::pool_allocator<std::pair<const t,t>>, _Mfl=false ] c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xtree(65) : see reference to class template instantiation 'std::_Tree_nod<_Traits>' being compiled with [ _Traits=std::_Tmap_traits<t,t,std::less<t>,boost::pool_allocator<std:: pair<const t,t>>,false> ] c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xtree(87) : see reference to class template instantiation 'std::_Tree_ptr<_Traits>' being compiled with [ _Traits=std::_Tmap_traits<t,t,std::less<t>,boost::pool_allocator<std:: pair<const t,t>>,false> ] c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xtree(105) : see reference to class template instantiation 'std::_Tree_val<_Traits>' being compiled with [ _Traits=std::_Tmap_traits<t,t,std::less<t>,boost::pool_allocator<std:: pair<const t,t>>,false> ] c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\map(77) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled with [ _Traits=std::_Tmap_traits<t,t,std::less<t>, boost::pool_allocator<std::pair<const t,t>>,false> ] c:\Documents and Settings\jharris\My Documents\Visual Studio Projects\stupid\stupid.cpp(12) : see reference to class template instantiation 'std::map<_Kty,_Ty,_Pr,_Alloc>' being compiled with [ _Kty=t, _Ty=t, _Pr=std::less<t>, _Alloc=boost::pool_allocator<std::pair<const t,t>> ] d:\tt-dev\misc\boost\1_30_0\dev\boost\pool\pool.hpp(492) : warning C4800: 'const boost::pool<UserAllocator>::size_type' : forcing value to bool 'true' or 'false' (performance warning) with [ UserAllocator=boost::default_user_allocator_new_delete ] d:\tt-dev\misc\boost\1_30_0 \dev\boost\pool\simple_segregated_storage.hpp(47) : while compiling class-template member function 'void *boost::pool<UserAllocator>::ordered_malloc (boost::pool<UserAllocator>::size_type)' with [ UserAllocator=boost::default_user_allocator_new_delete ] Another test I tried was a map<string,string>, actually declared like this: typedef std::basic_string<char,std::char_traits<char>,boost::pool_allocator<ch ar> > t; std::map<t, t, std::less<t>, boost::pool_allocator<std::pair<const t, t> > > m; ...and got these errors: c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\functional(139) : error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const t' c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xtree(1170) : see declaration of 'std::operator`<'' c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\functional(138) : while compiling class-template member function 'bool std::less<_Ty>::operator ()(const _Ty &,const _Ty &) const' with [ _Ty=t ] c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\map(67) : see reference to class template instantiation 'std::less<_Ty>' being compiled with [ _Ty=t ] c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xtree(23) : see reference to class template instantiation 'std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,_Mfl>' being compiled with [ _Kty=t, _Ty=t, _Pr=std::less<t>, _Alloc=boost::pool_allocator<std::pair<const t,t>>, _Mfl=false ] c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xtree(65) : see reference to class template instantiation 'std::_Tree_nod<_Traits>' being compiled with [ _Traits=std::_Tmap_traits<t,t,std::less<t>,boost::pool_allocator<std:: pair<const t,t>>,false> ] c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xtree(87) : see reference to class template instantiation 'std::_Tree_ptr<_Traits>' being compiled with [ _Traits=std::_Tmap_traits<t,t,std::less<t>,boost::pool_allocator<std:: pair<const t,t>>,false> ] c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xtree(105) : see reference to class template instantiation 'std::_Tree_val<_Traits>' being compiled with [ _Traits=std::_Tmap_traits<t,t,std::less<t>,boost::pool_allocator<std:: pair<const t,t>>,false> ] c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\map(77) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled with [ _Traits=std::_Tmap_traits<t,t,std::less<t>,boost::pool_allocator<std:: pair<const t,t>>,false> ] c:\Documents and Settings\jharris\My Documents\Visual Studio Projects\stupid\stupid.cpp(12) : see reference to class template instantiation 'std::map<_Kty,_Ty,_Pr,_Alloc>' being compiled with [ _Kty=t, _Ty=t, _Pr=std::less<t>, _Alloc=boost::pool_allocator<std::pair<const t,t>> ] <snip> If you have an example of a map<string,string> using pool_allocator that compiles on VC7.1, I'd *love* to see it. That's all I'm really after, here. TIA for your replies. john harris
participants (3)
-
Ilya Chvetsov(work)
-
John Harris
-
sclearyï¼ jerviswebb.com