Boost logo

Boost Users :

From: John Harris (john.harris_at_[hidden])
Date: 2003-04-23 10:24:33


--- In Boost-Users_at_[hidden], "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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net