Boost logo

Boost Users :

From: John Harris (john.harris_at_[hidden])
Date: 2003-04-23 07:23:25


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


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