Кто знает почему субж не умеет работать с константными типами?
#include <iostream>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/global_fun.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/identity.hpp>
int main()
{
boost::multi_index_container<const int> t;
t.insert(5);
std::cout << *t.begin() << std::endl;
}
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.cpp"
In file included from /usr/include/x86_64-linux-gnu/c++/4.7/./bits/c++allocator.h:34:0,
from /usr/include/c++/4.7/bits/allocator.h:48,
from /usr/include/c++/4.7/string:43,
from /usr/include/c++/4.7/bits/locale_classes.h:42,
from /usr/include/c++/4.7/bits/ios_base.h:43,
from /usr/include/c++/4.7/ios:43,
from /usr/include/c++/4.7/ostream:40,
from /usr/include/c++/4.7/iostream:40,
from ../main.cpp:13:
/usr/include/c++/4.7/ext/new_allocator.h: In instantiation of «class __gnu_cxx::new_allocator<const int>»:
/usr/include/c++/4.7/bits/allocator.h:89:11: required from «class std::allocator<const int>»
/usr/include/boost/detail/allocator_utilities.hpp:149:31: required from «struct boost::detail::allocator::rebinder<std::allocator<const int> >::result<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<const int, std::allocator<const int> > > >»
/usr/include/boost/detail/allocator_utilities.hpp:158:49: required from «struct boost::detail::allocator::compliant_allocator_rebind_to<std::allocator<const int>, boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<const int, std::allocator<const int> > > >»
/usr/include/boost/mpl/eval_if.hpp:60:31: required from «struct boost::mpl::eval_if_c<false, boost::detail::allocator::partial_std_allocator_rebind_to<std::allocator<const int>, boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<const int, std::allocator<const int> > > >, boost::detail::allocator::compliant_allocator_rebind_to<std::allocator<const int>, boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<const int, std::allocator<const int> > > > >»
/usr/include/boost/detail/allocator_utilities.hpp:164:8: required from «struct boost::detail::allocator::rebind_to<std::allocator<const int>, boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<const int, std::allocator<const int> > > >»
/usr/include/boost/multi_index_container.hpp:70:7: required from «class boost::multi_index::multi_index_container<const int>»
../main.cpp:22:42: required from here
/usr/include/c++/4.7/ext/new_allocator.h:83:7: ошибка: «const _Tp* __gnu_cxx::new_allocator<_Tp>::address(__gnu_cxx::new_allocator<_Tp>::const_reference) const [with _Tp = const int; __gnu_cxx::new_allocator<_Tp>::const_pointer = const int*; __gnu_cxx::new_allocator<_Tp>::const_reference = const int&]» cannot be overloaded
/usr/include/c++/4.7/ext/new_allocator.h:79:7: ошибка: with «_Tp* __gnu_cxx::new_allocator<_Tp>::address(__gnu_cxx::new_allocator<_Tp>::reference) const [with _Tp = const int; __gnu_cxx::new_allocator<_Tp>::pointer = const int*; __gnu_cxx::new_allocator<_Tp>::reference = const int&]»
In file included from /usr/include/boost/multi_index/detail/base_type.hpp:21:0,
from /usr/include/boost/multi_index_container.hpp:33,
from ../main.cpp:15:
/usr/include/boost/multi_index/detail/index_base.hpp: In instantiation of «boost::multi_index::detail::index_base<Value, IndexSpecifierList, Allocator>::node_type* boost::multi_index::detail::index_base<Value, IndexSpecifierList, Allocator>::insert_(boost::multi_index::detail::index_base<Value, IndexSpecifierList, Allocator>::value_param_type, boost::multi_index::detail::index_base<Value, IndexSpecifierList, Allocator>::node_type*) [with Value = const int; IndexSpecifierList = boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::identity<const int>, mpl_::na, mpl_::na>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>; Allocator = std::allocator<const int>; boost::multi_index::detail::index_base<Value, IndexSpecifierList, Allocator>::node_type = boost::multi_index::detail::index_node_base<const int, std::allocator<const int> >; boost::multi_index::detail::index_base<Value, IndexSpecifierList, Allocator>::value_param_type = const int]»:
/usr/include/boost/multi_index/ordered_index.hpp:633:63: required from «boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::node_type* boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::insert_(boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::value_param_type, boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::node_type*) [with KeyFromValue = boost::multi_index::identity<const int>; Compare = std::less<const int>; SuperMeta = boost::multi_index::detail::nth_layer<1, const int, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::identity<const int>, mpl_::na, mpl_::na>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, std::allocator<const int> >; TagList = boost::mpl::vector0<mpl_::na>; Category = boost::multi_index::detail::ordered_unique_tag; boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::node_type = boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<const int, std::allocator<const int> > >; typename SuperMeta::type::node_type = boost::multi_index::detail::index_node_base<const int, std::allocator<const int> >; boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::value_param_type = const int]»
/usr/include/boost/multi_index_container.hpp:488:40: required from «std::pair<typename boost::multi_index::detail::multi_index_base_type<Value, IndexSpecifierList, Allocator>::type::node_type*, bool> boost::multi_index::multi_index_container<Value, IndexSpecifierList, Allocator>::insert_(const Value&) [with Value = const int; IndexSpecifierList = boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::identity<const int>, mpl_::na, mpl_::na>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>; Allocator = std::allocator<const int>; typename boost::multi_index::detail::multi_index_base_type<Value, IndexSpecifierList, Allocator>::type::node_type = boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<const int, std::allocator<const int> > >]»
/usr/include/boost/multi_index/detail/index_base.hpp:150:30: required from «std::pair<typename boost::multi_index::detail::multi_index_node_type<Value, IndexSpecifierList, Allocator>::type*, bool> boost::multi_index::detail::index_base<Value, IndexSpecifierList, Allocator>::final_insert_(boost::multi_index::detail::index_base<Value, IndexSpecifierList, Allocator>::value_param_type) [with Value = const int; IndexSpecifierList = boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::identity<const int>, mpl_::na, mpl_::na>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>; Allocator = std::allocator<const int>; typename boost::multi_index::detail::multi_index_node_type<Value, IndexSpecifierList, Allocator>::type = boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<const int, std::allocator<const int> > >; boost::multi_index::detail::index_base<Value, IndexSpecifierList, Allocator>::value_param_type = const int]»
/usr/include/boost/multi_index/ordered_index.hpp:275:61: required from «std::pair<boost::multi_index::detail::bidir_node_iterator<boost::multi_index::detail::ordered_index_node<typename SuperMeta::type::node_type> >, bool> boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::insert(boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::value_param_type) [with KeyFromValue = boost::multi_index::identity<const int>; Compare = std::less<const int>; SuperMeta = boost::multi_index::detail::nth_layer<1, const int, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::identity<const int>, mpl_::na, mpl_::na>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, std::allocator<const int> >; TagList = boost::mpl::vector0<mpl_::na>; Category = boost::multi_index::detail::ordered_unique_tag; typename SuperMeta::type::node_type = boost::multi_index::detail::index_node_base<const int, std::allocator<const int> >; boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::value_param_type = const int]»
../main.cpp:24:12: required from here
/usr/include/boost/multi_index/detail/index_base.hpp:88:5: ошибка: нет соответствующей функции для вызова «construct(boost::multi_index::detail::index_node_base<const int, std::allocator<const int> >::value_type*, boost::multi_index::detail::index_base<const int, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::identity<const int>, mpl_::na, mpl_::na>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, std::allocator<const int> >::value_param_type&)»
/usr/include/boost/multi_index/detail/index_base.hpp:88:5: замечание: candidate is:
In file included from /usr/include/boost/multi_index_container.hpp:20:0,
from ../main.cpp:15:
/usr/include/boost/detail/allocator_utilities.hpp:176:6: замечание: template<class Type> void boost::detail::allocator::construct(void*, const Type&)
/usr/include/boost/detail/allocator_utilities.hpp:176:6: замечание: template argument deduction/substitution failed:
In file included from /usr/include/boost/multi_index/detail/base_type.hpp:21:0,
from /usr/include/boost/multi_index_container.hpp:33,
from ../main.cpp:15:
/usr/include/boost/multi_index/detail/index_base.hpp:88:5: замечание: cannot convert «& x->boost::multi_index::detail::index_node_base<Value, Allocator>::value<const int, std::allocator<const int> >()» (type «boost::multi_index::detail::index_node_base<const int, std::allocator<const int> >::value_type* {aka const int*}») to type «void*»
make: *** [main.o] Ошибка 1
Такое чувство, что я единственнй кто это пробовал, ибо в гугле ничего похожего ненашел.