RE: [Boost-Users] pool_allocator problems on VC7.1 (real release)

John Harris <john.harris@tradingtechnologies.com> wrote:
scleary@jerviswebb.com 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.
VC++ has produced that warning for a while now, and it's totally bogus. Notice that it's a "performance warning" not an "are you sure this is that you want?" warning, and it's being generated here for *casts* not implicit conversions. <snip>
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: <snip>
I compiled almost the exact same code: #include <boost/pool/pool_alloc.hpp> #include <map> #include <utility> typedef std::basic_string<char,std::char_traits<char>,boost::pool_allocator<char
t;
int main() { std::map<t, t, std::less<t>, boost::pool_allocator<std::pair<const t, t> > > m; } with VC++ 7.0 and Boost 1.29, and got no warnings or errors at all. The command line was: cl /D__WIN32__ /EHsc /I"c:\program files\boost" test.cpp I repeated this with Boost 1.30 and again got no warnings or errors. I don't have VC++ 7.1 to hand, but I would be surprised if it broke anything that worked in 7.0.

--- In Boost-Users@yahoogroups.com, "Ben Hutchings" > I compiled almost the exact same code:
#include <boost/pool/pool_alloc.hpp> #include <map> #include <utility>
typedef
std::basic_string<char,std::char_traits<char>,boost::pool_allocator<ch ar
t;
int main() { std::map<t, t, std::less<t>, boost::pool_allocator<std::pair<const t, t> > > m; }
with VC++ 7.0 and Boost 1.29, and got no warnings or errors at all.
Ah, yes, that works for me, too (no warning, either), but try adding a line of code that actually uses the map, like this: m["abc"] = "def"; and you get the following cascade of errors: stupid.cpp 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> ] 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>> ] 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(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(139) : error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const t' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xutility(655) : see declaration of 'std::operator`<'' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\functional(139) : error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const t' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xutility(655) : see declaration of 'std::operator`<'' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\functional(139) : error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const t' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xutility(655) : see declaration of 'std::operator`<'' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\functional(139) : error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const t' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\utility(73) : see declaration of 'std::operator`<'' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\functional(139) : error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const t' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\utility(73) : see declaration of 'std::operator`<'' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\functional(139) : error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const t' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\utility(73) : see declaration of 'std::operator`<'' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\functional(139) : error C2676: binary '<' : 'const t' does not define this operator or a conversion to a type acceptable to the predefined operator
I don't have VC++ 7.1 to hand, but I would be surprised if it broke anything that worked in 7.0.
participants (2)
-
Ben Hutchings
-
John Harris