Boost logo

Boost Users :

Subject: [Boost-users] Boost.Container string operator+ problem
From: dave_chp (dave_at_[hidden])
Date: 2011-12-23 06:38:52


Using boost 1.48 and vs2010 gives me an error when trying to use
boost::container::string.

#include <boost/container/string.hpp>

int main( int, char *[] )
{
    using boost::container::string;
    string hello = "hello ";
    string world = "world";
    string hello_world = hello + world;
}

1>d:\sdk\boost_1_48_0\boost\container\string.hpp(2368): error C2248:
'boost::container::containers_detail::basic_string_base ::alloc' : cannot
access protected member declared in class
'boost::container::containers_detail::basic_string_base '
1> with
1> [
1> A=std::allocator<char>
1> ]
1> d:\sdk\boost_1_48_0\boost\container\string.hpp(214) : see
declaration of 'boost::container::containers_detail::basic_string_base
::alloc'
1> with
1> [
1> A=std::allocator<char>
1> ]
1> d:\tmp\xxx.cpp(15) : see reference to function template
instantiation 'boost::container::basic_string<CharT,Traits,A>
boost::container::operator
+<char,std::char_traits&lt;char>,std::allocator<_Ty>>(const
boost::container::basic_string<CharT,Traits,A> &,const
boost::container::basic_string<CharT,Traits,A> &)' being compiled
1> with
1> [
1> CharT=char,
1> Traits=std::char_traits<char>,
1> A=std::allocator<char>,
1> _Ty=char
1> ]
1> d:\tmp\xxx.cpp(20) : see reference to function template
instantiation 'void hello_world_test<boost::container::string>(void)' being
compiled
1>

template <class CharT, class Traits, class A>
inline basic_string<CharT,Traits,A>
operator+(const basic_string<CharT,Traits,A>& x, const
basic_string<CharT,Traits,A>& y)
{
 ...
   str_t result(reserve, x.size() + y.size(), x.alloc());
...
}

should this maybe be x.get_allocator() instead of x.alloc()?

--
View this message in context: http://boost.2283326.n4.nabble.com/Boost-Container-string-operator-problem-tp4228286p4228286.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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