Hi,
first the used versions:
boost 1.63.0
gcc 5.4.0 20160609
Ubuntu 16.04.1
the example I've problems with is:
#include <map>
#include
using boost::container::small_vector;
typedef std::pair > mypair;
typedef std::map mymap;
typedef std::map > mymap2;
typedef std::map, 8> > mymap3;
int main()
{
mymap m;
mypair& sv = m[0];
mymap2 m2;
small_vector& sv2 = m2[0];
mymap3 m3;
small_vector, 8>& sv3 = m3[0];
}
I can compile it without errors with 'g++ -std=c++11', but without
'-std=c++11' I'm getting an error for the 'operator[]' on mymap2:
dan@octa ~> g++ -Iboost_1_63_0/ small_vector_test.cpp
In file included from boost_1_63_0/boost/container/small_vector.hpp:27:0,
from small_vector_test.cpp:2:
boost_1_63_0/boost/container/vector.hpp: In instantiation of ‘void boost::container::vector::assign(FwdIt, FwdIt, typename boost::move_detail::disable_if_or >, boost::move_detail::is_convertible, boost::container::container_detail::is_input_iterator<FwdIt> >::type*) [with FwdIt = boost::container::container_detail::vec_iterator >*, true>; T = std::pair >; Allocator = boost::container::small_vector_allocator > > >; typename boost::move_detail::disable_if_or >, boost::move_detail::is_convertible, boost::container::container_detail::is_input_iterator<FwdIt> >::type = void]’:
boost_1_63_0/boost/container/small_vector.hpp:563:7: required from ‘boost::container::small_vector::small_vector(const boost::container::small_vector&) [with T = std::pair >; long unsigned int N = 8ul; Allocator = boost::container::new_allocator > >]’
/usr/include/c++/5/bits/stl_pair.h:113:31: required from ‘std::pair<_T1, _T2>::pair(const _T1&, const _T2&) [with _T1 = const int; _T2 = boost::container::small_vector >, 8ul>]’
/usr/include/c++/5/bits/stl_map.h:487:23: required from ‘std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = int; _Tp = boost::container::small_vector >, 8ul>; _Compare = std::less<int>; _Alloc = std::allocator >, 8ul> > >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = boost::container::small_vector >, 8ul>; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = int]’
small_vector_test.cpp:18:39: required from here
boost_1_63_0/boost/container/vector.hpp:1261:15: error: binding ‘const std::pair >’ to reference of type ‘std::pair >&’ discards qualifiers
*cur = *first;
^
In file included from /usr/include/c++/5/bits/stl_algobase.h:64:0,
from /usr/include/c++/5/bits/stl_tree.h:63,
from /usr/include/c++/5/map:60,
from small_vector_test.cpp:1:
/usr/include/c++/5/bits/stl_pair.h:96:12: note: initializing argument 1 of ‘std::pair >& std::pair >::operator=(std::pair >&)’
struct pair
^
Any ideas?
Is 'boost:container::small_vector' supposed to work without C++11 support?
Thanks!
Greetings,
Daniel