Chris@16: /* Multiply indexed container. Chris@16: * Chris@101: * Copyright 2003-2014 Joaquin M Lopez Munoz. Chris@16: * Distributed under the Boost Software License, Version 1.0. Chris@16: * (See accompanying file LICENSE_1_0.txt or copy at Chris@16: * http://www.boost.org/LICENSE_1_0.txt) Chris@16: * Chris@16: * See http://www.boost.org/libs/multi_index for library home page. Chris@16: */ Chris@16: Chris@16: #ifndef BOOST_MULTI_INDEX_HPP Chris@16: #define BOOST_MULTI_INDEX_HPP Chris@16: Chris@101: #if defined(_MSC_VER) Chris@16: #pragma once Chris@16: #endif Chris@16: Chris@16: #include /* keep it first to prevent nasty warns in MSVC */ Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) Chris@16: #include Chris@16: #endif Chris@16: Chris@16: #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #endif Chris@16: Chris@16: #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) Chris@16: #include Chris@16: #define BOOST_MULTI_INDEX_CHECK_INVARIANT_OF(x) \ Chris@16: detail::scope_guard BOOST_JOIN(check_invariant_,__LINE__)= \ Chris@16: detail::make_obj_guard(x,&multi_index_container::check_invariant_); \ Chris@16: BOOST_JOIN(check_invariant_,__LINE__).touch(); Chris@16: #define BOOST_MULTI_INDEX_CHECK_INVARIANT \ Chris@16: BOOST_MULTI_INDEX_CHECK_INVARIANT_OF(*this) Chris@16: #else Chris@16: #define BOOST_MULTI_INDEX_CHECK_INVARIANT_OF(x) Chris@16: #define BOOST_MULTI_INDEX_CHECK_INVARIANT Chris@16: #endif Chris@16: Chris@16: namespace boost{ Chris@16: Chris@16: namespace multi_index{ Chris@16: Chris@16: #if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500)) Chris@16: #pragma warning(push) Chris@16: #pragma warning(disable:4522) /* spurious warning on multiple operator=()'s */ Chris@16: #endif Chris@16: Chris@16: template Chris@16: class multi_index_container: Chris@16: private ::boost::base_from_member< Chris@16: typename boost::detail::allocator::rebind_to< Chris@16: Allocator, Chris@16: typename detail::multi_index_node_type< Chris@16: Value,IndexSpecifierList,Allocator>::type Chris@16: >::type>, Chris@16: BOOST_MULTI_INDEX_PRIVATE_IF_MEMBER_TEMPLATE_FRIENDS detail::header_holder< Chris@101: typename boost::detail::allocator::rebind_to< Chris@16: Allocator, Chris@101: typename detail::multi_index_node_type< Chris@101: Value,IndexSpecifierList,Allocator>::type Chris@16: >::type::pointer, Chris@16: multi_index_container >, Chris@16: public detail::multi_index_base_type< Chris@16: Value,IndexSpecifierList,Allocator>::type Chris@16: { Chris@16: #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ Chris@16: BOOST_WORKAROUND(__MWERKS__,<=0x3003) Chris@16: /* The "ISO C++ Template Parser" option in CW8.3 has a problem with the Chris@16: * lifetime of const references bound to temporaries --precisely what Chris@16: * scopeguards are. Chris@16: */ Chris@16: Chris@16: #pragma parse_mfunc_templ off Chris@16: #endif Chris@16: Chris@16: private: Chris@16: BOOST_COPYABLE_AND_MOVABLE(multi_index_container) Chris@16: Chris@16: #if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) Chris@16: template friend class detail::index_base; Chris@16: template friend struct detail::header_holder; Chris@16: template friend struct detail::converter; Chris@16: #endif Chris@16: Chris@16: typedef typename detail::multi_index_base_type< Chris@16: Value,IndexSpecifierList,Allocator>::type super; Chris@16: typedef typename Chris@16: boost::detail::allocator::rebind_to< Chris@101: Allocator, Chris@101: typename super::node_type Chris@16: >::type node_allocator; Chris@16: typedef ::boost::base_from_member< Chris@16: node_allocator> bfm_allocator; Chris@16: typedef detail::header_holder< Chris@101: typename node_allocator::pointer, Chris@16: multi_index_container> bfm_header; Chris@16: Chris@16: Chris@16: public: Chris@16: /* All types are inherited from super, a few are explicitly Chris@16: * brought forward here to save us some typename's. Chris@16: */ Chris@16: Chris@101: typedef typename super::ctor_args_list ctor_args_list; Chris@101: typedef IndexSpecifierList index_specifier_type_list; Chris@16: Chris@16: typedef typename super::index_type_list index_type_list; Chris@16: Chris@16: typedef typename super::iterator_type_list iterator_type_list; Chris@16: typedef typename super::const_iterator_type_list const_iterator_type_list; Chris@16: typedef typename super::value_type value_type; Chris@16: typedef typename super::final_allocator_type allocator_type; Chris@16: typedef typename super::iterator iterator; Chris@16: typedef typename super::const_iterator const_iterator; Chris@16: Chris@16: BOOST_STATIC_ASSERT( Chris@16: detail::no_duplicate_tags_in_index_list::value); Chris@16: Chris@16: /* global project() needs to see this publicly */ Chris@16: Chris@16: typedef typename super::node_type node_type; Chris@16: Chris@16: /* construct/copy/destroy */ Chris@16: Chris@16: explicit multi_index_container( Chris@16: Chris@16: #if BOOST_WORKAROUND(__IBMCPP__,<=600) Chris@16: /* VisualAge seems to have an ETI issue with the default values Chris@16: * for arguments args_list and al. Chris@16: */ Chris@16: Chris@16: const ctor_args_list& args_list= Chris@16: typename mpl::identity::type:: Chris@16: ctor_args_list(), Chris@16: const allocator_type& al= Chris@16: typename mpl::identity::type:: Chris@16: allocator_type()): Chris@16: #else Chris@16: const ctor_args_list& args_list=ctor_args_list(), Chris@16: const allocator_type& al=allocator_type()): Chris@16: #endif Chris@16: Chris@16: bfm_allocator(al), Chris@16: super(args_list,bfm_allocator::member), Chris@16: node_count(0) Chris@16: { Chris@16: BOOST_MULTI_INDEX_CHECK_INVARIANT; Chris@16: } Chris@16: Chris@16: explicit multi_index_container(const allocator_type& al): Chris@16: bfm_allocator(al), Chris@16: super(ctor_args_list(),bfm_allocator::member), Chris@16: node_count(0) Chris@16: { Chris@16: BOOST_MULTI_INDEX_CHECK_INVARIANT; Chris@16: } Chris@16: Chris@16: template Chris@16: multi_index_container( Chris@16: InputIterator first,InputIterator last, Chris@16: Chris@16: #if BOOST_WORKAROUND(__IBMCPP__,<=600) Chris@16: /* VisualAge seems to have an ETI issue with the default values Chris@16: * for arguments args_list and al. Chris@16: */ Chris@16: Chris@16: const ctor_args_list& args_list= Chris@16: typename mpl::identity::type:: Chris@16: ctor_args_list(), Chris@16: const allocator_type& al= Chris@16: typename mpl::identity::type:: Chris@16: allocator_type()): Chris@16: #else Chris@16: const ctor_args_list& args_list=ctor_args_list(), Chris@16: const allocator_type& al=allocator_type()): Chris@16: #endif Chris@16: Chris@16: bfm_allocator(al), Chris@16: super(args_list,bfm_allocator::member), Chris@16: node_count(0) Chris@16: { Chris@16: BOOST_MULTI_INDEX_CHECK_INVARIANT; Chris@16: BOOST_TRY{ Chris@16: iterator hint=super::end(); Chris@16: for(;first!=last;++first){ Chris@16: hint=super::make_iterator( Chris@16: insert_ref_(*first,hint.get_node()).first); Chris@16: ++hint; Chris@16: } Chris@16: } Chris@16: BOOST_CATCH(...){ Chris@16: clear_(); Chris@16: BOOST_RETHROW; Chris@16: } Chris@16: BOOST_CATCH_END Chris@16: } Chris@16: Chris@16: #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) Chris@16: multi_index_container( Chris@16: std::initializer_list list, Chris@16: const ctor_args_list& args_list=ctor_args_list(), Chris@16: const allocator_type& al=allocator_type()): Chris@16: bfm_allocator(al), Chris@16: super(args_list,bfm_allocator::member), Chris@16: node_count(0) Chris@16: { Chris@16: BOOST_MULTI_INDEX_CHECK_INVARIANT; Chris@16: BOOST_TRY{ Chris@101: typedef const Value* init_iterator; Chris@16: Chris@16: iterator hint=super::end(); Chris@16: for(init_iterator first=list.begin(),last=list.end(); Chris@16: first!=last;++first){ Chris@16: hint=super::make_iterator(insert_(*first,hint.get_node()).first); Chris@16: ++hint; Chris@16: } Chris@16: } Chris@16: BOOST_CATCH(...){ Chris@16: clear_(); Chris@16: BOOST_RETHROW; Chris@16: } Chris@16: BOOST_CATCH_END Chris@16: } Chris@16: #endif Chris@16: Chris@16: multi_index_container( Chris@16: const multi_index_container& x): Chris@16: bfm_allocator(x.bfm_allocator::member), Chris@16: bfm_header(), Chris@16: super(x), Chris@16: node_count(0) Chris@16: { Chris@16: copy_map_type map(bfm_allocator::member,x.size(),x.header(),header()); Chris@16: for(const_iterator it=x.begin(),it_end=x.end();it!=it_end;++it){ Chris@16: map.clone(it.get_node()); Chris@16: } Chris@16: super::copy_(x,map); Chris@16: map.release(); Chris@16: node_count=x.size(); Chris@16: Chris@16: /* Not until this point are the indices required to be consistent, Chris@16: * hence the position of the invariant checker. Chris@16: */ Chris@16: Chris@16: BOOST_MULTI_INDEX_CHECK_INVARIANT; Chris@16: } Chris@16: Chris@16: multi_index_container(BOOST_RV_REF(multi_index_container) x): Chris@16: bfm_allocator(x.bfm_allocator::member), Chris@16: bfm_header(), Chris@16: super(x,detail::do_not_copy_elements_tag()), Chris@16: node_count(0) Chris@16: { Chris@16: BOOST_MULTI_INDEX_CHECK_INVARIANT; Chris@16: BOOST_MULTI_INDEX_CHECK_INVARIANT_OF(x); Chris@16: swap_elements_(x); Chris@16: } Chris@16: Chris@16: ~multi_index_container() Chris@16: { Chris@16: delete_all_nodes_(); Chris@16: } Chris@16: Chris@16: #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) Chris@16: /* As per http://www.boost.org/doc/html/move/emulation_limitations.html Chris@16: * #move.emulation_limitations.assignment_operator Chris@16: */ Chris@16: Chris@16: multi_index_container& operator=( Chris@16: const multi_index_container& x) Chris@16: { Chris@16: multi_index_container y(x); Chris@16: this->swap(y); Chris@16: return *this; Chris@16: } Chris@16: #endif Chris@16: Chris@16: multi_index_container& operator=( Chris@16: BOOST_COPY_ASSIGN_REF(multi_index_container) x) Chris@16: { Chris@16: multi_index_container y(x); Chris@16: this->swap(y); Chris@16: return *this; Chris@16: } Chris@16: Chris@16: multi_index_container& operator=( Chris@16: BOOST_RV_REF(multi_index_container) x) Chris@16: { Chris@16: this->swap(x); Chris@16: return *this; Chris@16: } Chris@16: Chris@16: #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) Chris@16: multi_index_container& operator=( Chris@16: std::initializer_list list) Chris@16: { Chris@16: BOOST_MULTI_INDEX_CHECK_INVARIANT; Chris@101: typedef const Value* init_iterator; Chris@16: Chris@16: multi_index_container x(*this,detail::do_not_copy_elements_tag()); Chris@16: iterator hint=x.end(); Chris@16: for(init_iterator first=list.begin(),last=list.end(); Chris@16: first!=last;++first){ Chris@16: hint=x.make_iterator(x.insert_(*first,hint.get_node()).first); Chris@16: ++hint; Chris@16: } Chris@16: x.swap_elements_(*this); Chris@16: return*this; Chris@16: } Chris@16: #endif Chris@16: Chris@101: allocator_type get_allocator()const BOOST_NOEXCEPT Chris@16: { Chris@16: return allocator_type(bfm_allocator::member); Chris@16: } Chris@16: Chris@16: /* retrieval of indices by number */ Chris@16: Chris@16: #if !defined(BOOST_NO_MEMBER_TEMPLATES) Chris@16: template Chris@16: struct nth_index Chris@16: { Chris@16: BOOST_STATIC_ASSERT(N>=0&&N::type::value); Chris@16: typedef typename mpl::at_c::type type; Chris@16: }; Chris@16: Chris@16: template Chris@101: typename nth_index::type& get()BOOST_NOEXCEPT Chris@16: { Chris@16: BOOST_STATIC_ASSERT(N>=0&&N::type::value); Chris@16: return *this; Chris@16: } Chris@16: Chris@16: template Chris@101: const typename nth_index::type& get()const BOOST_NOEXCEPT Chris@16: { Chris@16: BOOST_STATIC_ASSERT(N>=0&&N::type::value); Chris@16: return *this; Chris@16: } Chris@16: #endif Chris@16: Chris@16: /* retrieval of indices by tag */ Chris@16: Chris@16: #if !defined(BOOST_NO_MEMBER_TEMPLATES) Chris@16: template Chris@16: struct index Chris@16: { Chris@16: typedef typename mpl::find_if< Chris@16: index_type_list, Chris@16: detail::has_tag Chris@16: >::type iter; Chris@16: Chris@16: BOOST_STATIC_CONSTANT( Chris@16: bool,index_found=!(is_same::type >::value)); Chris@16: BOOST_STATIC_ASSERT(index_found); Chris@16: Chris@16: typedef typename mpl::deref::type type; Chris@16: }; Chris@16: Chris@16: template Chris@101: typename index::type& get()BOOST_NOEXCEPT Chris@16: { Chris@16: return *this; Chris@16: } Chris@16: Chris@16: template Chris@101: const typename index::type& get()const BOOST_NOEXCEPT Chris@16: { Chris@16: return *this; Chris@16: } Chris@16: #endif Chris@16: Chris@16: /* projection of iterators by number */ Chris@16: Chris@16: #if !defined(BOOST_NO_MEMBER_TEMPLATES) Chris@16: template Chris@16: struct nth_index_iterator Chris@16: { Chris@16: typedef typename nth_index::type::iterator type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct nth_index_const_iterator Chris@16: { Chris@16: typedef typename nth_index::type::const_iterator type; Chris@16: }; Chris@16: Chris@16: template Chris@101: typename nth_index_iterator::type project(IteratorType it) Chris@16: { Chris@101: typedef typename nth_index::type index_type; Chris@16: Chris@16: #if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* fails in Sun C++ 5.7 */ Chris@16: BOOST_STATIC_ASSERT( Chris@16: (mpl::contains::value)); Chris@16: #endif Chris@16: Chris@16: BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); Chris@16: BOOST_MULTI_INDEX_CHECK_IS_OWNER( Chris@16: it,static_cast(*this)); Chris@16: Chris@101: return index_type::make_iterator(static_cast(it.get_node())); Chris@16: } Chris@16: Chris@16: template Chris@101: typename nth_index_const_iterator::type project(IteratorType it)const Chris@16: { Chris@101: typedef typename nth_index::type index_type; Chris@16: Chris@16: #if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* fails in Sun C++ 5.7 */ Chris@16: BOOST_STATIC_ASSERT(( Chris@16: mpl::contains::value|| Chris@16: mpl::contains::value)); Chris@16: #endif Chris@16: Chris@16: BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); Chris@16: BOOST_MULTI_INDEX_CHECK_IS_OWNER( Chris@16: it,static_cast(*this)); Chris@101: return index_type::make_iterator(static_cast(it.get_node())); Chris@16: } Chris@16: #endif Chris@16: Chris@16: /* projection of iterators by tag */ Chris@16: Chris@16: #if !defined(BOOST_NO_MEMBER_TEMPLATES) Chris@16: template Chris@16: struct index_iterator Chris@16: { Chris@16: typedef typename index::type::iterator type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct index_const_iterator Chris@16: { Chris@16: typedef typename index::type::const_iterator type; Chris@16: }; Chris@16: Chris@16: template Chris@101: typename index_iterator::type project(IteratorType it) Chris@16: { Chris@101: typedef typename index::type index_type; Chris@16: Chris@16: #if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* fails in Sun C++ 5.7 */ Chris@16: BOOST_STATIC_ASSERT( Chris@16: (mpl::contains::value)); Chris@16: #endif Chris@16: Chris@16: BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); Chris@16: BOOST_MULTI_INDEX_CHECK_IS_OWNER( Chris@16: it,static_cast(*this)); Chris@101: return index_type::make_iterator(static_cast(it.get_node())); Chris@16: } Chris@16: Chris@16: template Chris@101: typename index_const_iterator::type project(IteratorType it)const Chris@16: { Chris@101: typedef typename index::type index_type; Chris@16: Chris@16: #if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* fails in Sun C++ 5.7 */ Chris@16: BOOST_STATIC_ASSERT(( Chris@16: mpl::contains::value|| Chris@16: mpl::contains::value)); Chris@16: #endif Chris@16: Chris@16: BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); Chris@16: BOOST_MULTI_INDEX_CHECK_IS_OWNER( Chris@16: it,static_cast(*this)); Chris@101: return index_type::make_iterator(static_cast(it.get_node())); Chris@16: } Chris@16: #endif Chris@16: Chris@16: BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: Chris@16: typedef typename super::copy_map_type copy_map_type; Chris@16: Chris@16: #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) Chris@16: multi_index_container( Chris@16: const multi_index_container& x, Chris@16: detail::do_not_copy_elements_tag): Chris@16: bfm_allocator(x.bfm_allocator::member), Chris@16: bfm_header(), Chris@16: super(x,detail::do_not_copy_elements_tag()), Chris@16: node_count(0) Chris@16: { Chris@16: BOOST_MULTI_INDEX_CHECK_INVARIANT; Chris@16: } Chris@16: #endif Chris@16: Chris@16: node_type* header()const Chris@16: { Chris@16: return &*bfm_header::member; Chris@16: } Chris@16: Chris@16: node_type* allocate_node() Chris@16: { Chris@16: return &*bfm_allocator::member.allocate(1); Chris@16: } Chris@16: Chris@16: void deallocate_node(node_type* x) Chris@16: { Chris@16: typedef typename node_allocator::pointer node_pointer; Chris@16: bfm_allocator::member.deallocate(static_cast(x),1); Chris@16: } Chris@16: Chris@16: bool empty_()const Chris@16: { Chris@16: return node_count==0; Chris@16: } Chris@16: Chris@16: std::size_t size_()const Chris@16: { Chris@16: return node_count; Chris@16: } Chris@16: Chris@16: std::size_t max_size_()const Chris@16: { Chris@16: return static_cast(-1); Chris@16: } Chris@16: Chris@16: template Chris@16: std::pair insert_(const Value& v,Variant variant) Chris@16: { Chris@101: node_type* x=0; Chris@101: node_type* res=super::insert_(v,x,variant); Chris@101: if(res==x){ Chris@101: ++node_count; Chris@101: return std::pair(res,true); Chris@16: } Chris@101: else{ Chris@101: return std::pair(res,false); Chris@16: } Chris@16: } Chris@16: Chris@16: std::pair insert_(const Value& v) Chris@16: { Chris@16: return insert_(v,detail::lvalue_tag()); Chris@16: } Chris@16: Chris@16: std::pair insert_rv_(const Value& v) Chris@16: { Chris@16: return insert_(v,detail::rvalue_tag()); Chris@16: } Chris@16: Chris@16: template Chris@16: std::pair insert_ref_(T& t) Chris@16: { Chris@16: node_type* x=allocate_node(); Chris@16: BOOST_TRY{ Chris@16: new(&x->value()) value_type(t); Chris@16: BOOST_TRY{ Chris@16: node_type* res=super::insert_(x->value(),x,detail::emplaced_tag()); Chris@16: if(res==x){ Chris@16: ++node_count; Chris@16: return std::pair(res,true); Chris@16: } Chris@16: else{ Chris@16: boost::detail::allocator::destroy(&x->value()); Chris@16: deallocate_node(x); Chris@16: return std::pair(res,false); Chris@16: } Chris@16: } Chris@16: BOOST_CATCH(...){ Chris@16: boost::detail::allocator::destroy(&x->value()); Chris@16: BOOST_RETHROW; Chris@16: } Chris@16: BOOST_CATCH_END Chris@16: } Chris@16: BOOST_CATCH(...){ Chris@16: deallocate_node(x); Chris@16: BOOST_RETHROW; Chris@16: } Chris@16: BOOST_CATCH_END Chris@16: } Chris@16: Chris@16: std::pair insert_ref_(const value_type& x) Chris@16: { Chris@16: return insert_(x); Chris@16: } Chris@16: Chris@16: std::pair insert_ref_(value_type& x) Chris@16: { Chris@16: return insert_(x); Chris@16: } Chris@16: Chris@16: template Chris@16: std::pair emplace_( Chris@16: BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) Chris@16: { Chris@16: node_type* x=allocate_node(); Chris@16: BOOST_TRY{ Chris@16: detail::vartempl_placement_new( Chris@16: &x->value(),BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); Chris@16: BOOST_TRY{ Chris@16: node_type* res=super::insert_(x->value(),x,detail::emplaced_tag()); Chris@16: if(res==x){ Chris@16: ++node_count; Chris@16: return std::pair(res,true); Chris@16: } Chris@16: else{ Chris@16: boost::detail::allocator::destroy(&x->value()); Chris@16: deallocate_node(x); Chris@16: return std::pair(res,false); Chris@16: } Chris@16: } Chris@16: BOOST_CATCH(...){ Chris@16: boost::detail::allocator::destroy(&x->value()); Chris@16: BOOST_RETHROW; Chris@16: } Chris@16: BOOST_CATCH_END Chris@16: } Chris@16: BOOST_CATCH(...){ Chris@16: deallocate_node(x); Chris@16: BOOST_RETHROW; Chris@16: } Chris@16: BOOST_CATCH_END Chris@16: } Chris@16: Chris@16: template Chris@16: std::pair insert_( Chris@16: const Value& v,node_type* position,Variant variant) Chris@16: { Chris@101: node_type* x=0; Chris@101: node_type* res=super::insert_(v,position,x,variant); Chris@101: if(res==x){ Chris@101: ++node_count; Chris@101: return std::pair(res,true); Chris@16: } Chris@101: else{ Chris@101: return std::pair(res,false); Chris@16: } Chris@16: } Chris@16: Chris@16: std::pair insert_(const Value& v,node_type* position) Chris@16: { Chris@16: return insert_(v,position,detail::lvalue_tag()); Chris@16: } Chris@16: Chris@16: std::pair insert_rv_(const Value& v,node_type* position) Chris@16: { Chris@16: return insert_(v,position,detail::rvalue_tag()); Chris@16: } Chris@16: Chris@16: template Chris@16: std::pair insert_ref_( Chris@16: T& t,node_type* position) Chris@16: { Chris@16: node_type* x=allocate_node(); Chris@16: BOOST_TRY{ Chris@16: new(&x->value()) value_type(t); Chris@16: BOOST_TRY{ Chris@16: node_type* res=super::insert_( Chris@16: x->value(),position,x,detail::emplaced_tag()); Chris@16: if(res==x){ Chris@16: ++node_count; Chris@16: return std::pair(res,true); Chris@16: } Chris@16: else{ Chris@16: boost::detail::allocator::destroy(&x->value()); Chris@16: deallocate_node(x); Chris@16: return std::pair(res,false); Chris@16: } Chris@16: } Chris@16: BOOST_CATCH(...){ Chris@16: boost::detail::allocator::destroy(&x->value()); Chris@16: BOOST_RETHROW; Chris@16: } Chris@16: BOOST_CATCH_END Chris@16: } Chris@16: BOOST_CATCH(...){ Chris@16: deallocate_node(x); Chris@16: BOOST_RETHROW; Chris@16: } Chris@16: BOOST_CATCH_END Chris@16: } Chris@16: Chris@16: std::pair insert_ref_( Chris@16: const value_type& x,node_type* position) Chris@16: { Chris@16: return insert_(x,position); Chris@16: } Chris@16: Chris@16: std::pair insert_ref_( Chris@16: value_type& x,node_type* position) Chris@16: { Chris@16: return insert_(x,position); Chris@16: } Chris@16: Chris@16: template Chris@16: std::pair emplace_hint_( Chris@16: node_type* position, Chris@16: BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) Chris@16: { Chris@16: node_type* x=allocate_node(); Chris@16: BOOST_TRY{ Chris@16: detail::vartempl_placement_new( Chris@16: &x->value(),BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); Chris@16: BOOST_TRY{ Chris@16: node_type* res=super::insert_( Chris@16: x->value(),position,x,detail::emplaced_tag()); Chris@16: if(res==x){ Chris@16: ++node_count; Chris@16: return std::pair(res,true); Chris@16: } Chris@16: else{ Chris@16: boost::detail::allocator::destroy(&x->value()); Chris@16: deallocate_node(x); Chris@16: return std::pair(res,false); Chris@16: } Chris@16: } Chris@16: BOOST_CATCH(...){ Chris@16: boost::detail::allocator::destroy(&x->value()); Chris@16: BOOST_RETHROW; Chris@16: } Chris@16: BOOST_CATCH_END Chris@16: } Chris@16: BOOST_CATCH(...){ Chris@16: deallocate_node(x); Chris@16: BOOST_RETHROW; Chris@16: } Chris@16: BOOST_CATCH_END Chris@16: } Chris@16: Chris@16: void erase_(node_type* x) Chris@16: { Chris@16: --node_count; Chris@16: super::erase_(x); Chris@16: deallocate_node(x); Chris@16: } Chris@16: Chris@16: void delete_node_(node_type* x) Chris@16: { Chris@16: super::delete_node_(x); Chris@16: deallocate_node(x); Chris@16: } Chris@16: Chris@16: void delete_all_nodes_() Chris@16: { Chris@16: super::delete_all_nodes_(); Chris@16: } Chris@16: Chris@16: void clear_() Chris@16: { Chris@16: delete_all_nodes_(); Chris@16: super::clear_(); Chris@16: node_count=0; Chris@16: } Chris@16: Chris@16: void swap_(multi_index_container& x) Chris@16: { Chris@16: if(bfm_allocator::member!=x.bfm_allocator::member){ Chris@16: detail::adl_swap(bfm_allocator::member,x.bfm_allocator::member); Chris@16: } Chris@16: std::swap(bfm_header::member,x.bfm_header::member); Chris@16: super::swap_(x); Chris@16: std::swap(node_count,x.node_count); Chris@16: } Chris@16: Chris@16: void swap_elements_( Chris@16: multi_index_container& x) Chris@16: { Chris@16: std::swap(bfm_header::member,x.bfm_header::member); Chris@16: super::swap_elements_(x); Chris@16: std::swap(node_count,x.node_count); Chris@16: } Chris@16: Chris@16: bool replace_(const Value& k,node_type* x) Chris@16: { Chris@16: return super::replace_(k,x,detail::lvalue_tag()); Chris@16: } Chris@16: Chris@16: bool replace_rv_(const Value& k,node_type* x) Chris@16: { Chris@16: return super::replace_(k,x,detail::rvalue_tag()); Chris@16: } Chris@16: Chris@16: template Chris@16: bool modify_(Modifier& mod,node_type* x) Chris@16: { Chris@16: mod(const_cast(x->value())); Chris@16: Chris@16: BOOST_TRY{ Chris@16: if(!super::modify_(x)){ Chris@16: deallocate_node(x); Chris@16: --node_count; Chris@16: return false; Chris@16: } Chris@16: else return true; Chris@16: } Chris@16: BOOST_CATCH(...){ Chris@16: deallocate_node(x); Chris@16: --node_count; Chris@16: BOOST_RETHROW; Chris@16: } Chris@16: BOOST_CATCH_END Chris@16: } Chris@16: Chris@16: template Chris@101: bool modify_(Modifier& mod,Rollback& back_,node_type* x) Chris@16: { Chris@16: mod(const_cast(x->value())); Chris@16: Chris@16: bool b; Chris@16: BOOST_TRY{ Chris@16: b=super::modify_rollback_(x); Chris@16: } Chris@16: BOOST_CATCH(...){ Chris@16: BOOST_TRY{ Chris@101: back_(const_cast(x->value())); Chris@16: BOOST_RETHROW; Chris@16: } Chris@16: BOOST_CATCH(...){ Chris@16: this->erase_(x); Chris@16: BOOST_RETHROW; Chris@16: } Chris@16: BOOST_CATCH_END Chris@16: } Chris@16: BOOST_CATCH_END Chris@16: Chris@16: BOOST_TRY{ Chris@16: if(!b){ Chris@101: back_(const_cast(x->value())); Chris@16: return false; Chris@16: } Chris@16: else return true; Chris@16: } Chris@16: BOOST_CATCH(...){ Chris@16: this->erase_(x); Chris@16: BOOST_RETHROW; Chris@16: } Chris@16: BOOST_CATCH_END Chris@16: } Chris@16: Chris@16: #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) Chris@16: /* serialization */ Chris@16: Chris@16: friend class boost::serialization::access; Chris@16: Chris@16: BOOST_SERIALIZATION_SPLIT_MEMBER() Chris@16: Chris@16: typedef typename super::index_saver_type index_saver_type; Chris@16: typedef typename super::index_loader_type index_loader_type; Chris@16: Chris@16: template Chris@16: void save(Archive& ar,const unsigned int version)const Chris@16: { Chris@16: const serialization::collection_size_type s(size_()); Chris@16: const detail::serialization_version value_version; Chris@16: ar< Chris@16: void load(Archive& ar,const unsigned int version) Chris@16: { Chris@16: BOOST_MULTI_INDEX_CHECK_INVARIANT; Chris@16: Chris@16: clear_(); Chris@16: serialization::collection_size_type s; Chris@16: detail::serialization_version value_version; Chris@16: if(version<1){ Chris@16: std::size_t sz; Chris@16: ar>>serialization::make_nvp("count",sz); Chris@16: s=static_cast(sz); Chris@16: } Chris@16: else{ Chris@16: ar>>serialization::make_nvp("count",s); Chris@16: } Chris@16: if(version<2){ Chris@16: value_version=0; Chris@16: } Chris@16: else{ Chris@16: ar>>serialization::make_nvp("value_version",value_version); Chris@16: } Chris@16: Chris@16: index_loader_type lm(bfm_allocator::member,s); Chris@16: Chris@16: for(std::size_t n=0;n value("item",ar,value_version); Chris@16: std::pair p=insert_( Chris@16: value.get(),super::end().get_node()); Chris@16: if(!p.second)throw_exception( Chris@16: archive::archive_exception( Chris@16: archive::archive_exception::other_exception)); Chris@16: ar.reset_object_address(&p.first->value(),&value.get()); Chris@16: lm.add(p.first,ar,version); Chris@16: } Chris@16: lm.add_track(header(),ar,version); Chris@16: Chris@16: super::load_(ar,version,lm); Chris@16: } Chris@16: #endif Chris@16: Chris@16: #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) Chris@16: /* invariant stuff */ Chris@16: Chris@16: bool invariant_()const Chris@16: { Chris@16: return super::invariant_(); Chris@16: } Chris@16: Chris@16: void check_invariant_()const Chris@16: { Chris@16: BOOST_MULTI_INDEX_INVARIANT_ASSERT(invariant_()); Chris@16: } Chris@16: #endif Chris@16: Chris@16: private: Chris@16: std::size_t node_count; Chris@16: Chris@16: #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ Chris@16: BOOST_WORKAROUND(__MWERKS__,<=0x3003) Chris@16: #pragma parse_mfunc_templ reset Chris@16: #endif Chris@16: }; Chris@16: Chris@16: #if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500)) Chris@16: #pragma warning(pop) /* C4522 */ Chris@16: #endif Chris@16: Chris@16: /* retrieval of indices by number */ Chris@16: Chris@16: template Chris@16: struct nth_index Chris@16: { Chris@16: BOOST_STATIC_CONSTANT( Chris@16: int, Chris@16: M=mpl::size::type::value); Chris@16: BOOST_STATIC_ASSERT(N>=0&&N::type type; Chris@16: }; Chris@16: Chris@16: template Chris@16: typename nth_index< Chris@16: multi_index_container,N>::type& Chris@16: get( Chris@101: multi_index_container& m)BOOST_NOEXCEPT Chris@16: { Chris@16: typedef multi_index_container< Chris@16: Value,IndexSpecifierList,Allocator> multi_index_type; Chris@16: typedef typename nth_index< Chris@16: multi_index_container< Chris@16: Value,IndexSpecifierList,Allocator>, Chris@16: N Chris@101: >::type index_type; Chris@16: Chris@16: BOOST_STATIC_ASSERT(N>=0&& Chris@16: N< Chris@16: mpl::size< Chris@16: BOOST_DEDUCED_TYPENAME multi_index_type::index_type_list Chris@16: >::type::value); Chris@16: Chris@101: return detail::converter::index(m); Chris@16: } Chris@16: Chris@16: template Chris@16: const typename nth_index< Chris@16: multi_index_container,N>::type& Chris@16: get( Chris@16: const multi_index_container& m Chris@101: )BOOST_NOEXCEPT Chris@16: { Chris@16: typedef multi_index_container< Chris@16: Value,IndexSpecifierList,Allocator> multi_index_type; Chris@16: typedef typename nth_index< Chris@16: multi_index_container< Chris@16: Value,IndexSpecifierList,Allocator>, Chris@16: N Chris@101: >::type index_type; Chris@16: Chris@16: BOOST_STATIC_ASSERT(N>=0&& Chris@16: N< Chris@16: mpl::size< Chris@16: BOOST_DEDUCED_TYPENAME multi_index_type::index_type_list Chris@16: >::type::value); Chris@16: Chris@101: return detail::converter::index(m); Chris@16: } Chris@16: Chris@16: /* retrieval of indices by tag */ Chris@16: Chris@16: template Chris@16: struct index Chris@16: { Chris@16: typedef typename MultiIndexContainer::index_type_list index_type_list; Chris@16: Chris@16: typedef typename mpl::find_if< Chris@16: index_type_list, Chris@16: detail::has_tag Chris@16: >::type iter; Chris@16: Chris@16: BOOST_STATIC_CONSTANT( Chris@16: bool,index_found=!(is_same::type >::value)); Chris@16: BOOST_STATIC_ASSERT(index_found); Chris@16: Chris@16: typedef typename mpl::deref::type type; Chris@16: }; Chris@16: Chris@16: template< Chris@16: typename Tag,typename Value,typename IndexSpecifierList,typename Allocator Chris@16: > Chris@16: typename ::boost::multi_index::index< Chris@16: multi_index_container,Tag>::type& Chris@16: get( Chris@101: multi_index_container& m)BOOST_NOEXCEPT Chris@16: { Chris@16: typedef multi_index_container< Chris@16: Value,IndexSpecifierList,Allocator> multi_index_type; Chris@16: typedef typename ::boost::multi_index::index< Chris@16: multi_index_container< Chris@16: Value,IndexSpecifierList,Allocator>, Chris@16: Tag Chris@101: >::type index_type; Chris@16: Chris@101: return detail::converter::index(m); Chris@16: } Chris@16: Chris@16: template< Chris@16: typename Tag,typename Value,typename IndexSpecifierList,typename Allocator Chris@16: > Chris@16: const typename ::boost::multi_index::index< Chris@16: multi_index_container,Tag>::type& Chris@16: get( Chris@16: const multi_index_container& m Chris@101: )BOOST_NOEXCEPT Chris@16: { Chris@16: typedef multi_index_container< Chris@16: Value,IndexSpecifierList,Allocator> multi_index_type; Chris@16: typedef typename ::boost::multi_index::index< Chris@16: multi_index_container< Chris@16: Value,IndexSpecifierList,Allocator>, Chris@16: Tag Chris@101: >::type index_type; Chris@16: Chris@101: return detail::converter::index(m); Chris@16: } Chris@16: Chris@16: /* projection of iterators by number */ Chris@16: Chris@16: template Chris@16: struct nth_index_iterator Chris@16: { Chris@101: typedef typename nth_index::type::iterator type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct nth_index_const_iterator Chris@16: { Chris@101: typedef typename nth_index::type::const_iterator type; Chris@16: }; Chris@16: Chris@16: template< Chris@16: int N,typename IteratorType, Chris@16: typename Value,typename IndexSpecifierList,typename Allocator> Chris@16: typename nth_index_iterator< Chris@16: multi_index_container,N>::type Chris@16: project( Chris@16: multi_index_container& m, Chris@101: IteratorType it) Chris@16: { Chris@16: typedef multi_index_container< Chris@16: Value,IndexSpecifierList,Allocator> multi_index_type; Chris@101: typedef typename nth_index::type index_type; Chris@16: Chris@101: #if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* Sun C++ 5.7 fails */ Chris@16: BOOST_STATIC_ASSERT(( Chris@16: mpl::contains< Chris@16: BOOST_DEDUCED_TYPENAME multi_index_type::iterator_type_list, Chris@16: IteratorType>::value)); Chris@16: #endif Chris@16: Chris@16: BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); Chris@16: Chris@16: #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) Chris@16: typedef detail::converter< Chris@16: multi_index_type, Chris@16: BOOST_DEDUCED_TYPENAME IteratorType::container_type> converter; Chris@16: BOOST_MULTI_INDEX_CHECK_IS_OWNER(it,converter::index(m)); Chris@16: #endif Chris@16: Chris@101: return detail::converter::iterator( Chris@16: m,static_cast(it.get_node())); Chris@16: } Chris@16: Chris@16: template< Chris@16: int N,typename IteratorType, Chris@16: typename Value,typename IndexSpecifierList,typename Allocator> Chris@16: typename nth_index_const_iterator< Chris@16: multi_index_container,N>::type Chris@16: project( Chris@16: const multi_index_container& m, Chris@101: IteratorType it) Chris@16: { Chris@16: typedef multi_index_container< Chris@16: Value,IndexSpecifierList,Allocator> multi_index_type; Chris@101: typedef typename nth_index::type index_type; Chris@16: Chris@101: #if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* Sun C++ 5.7 fails */ Chris@16: BOOST_STATIC_ASSERT(( Chris@16: mpl::contains< Chris@16: BOOST_DEDUCED_TYPENAME multi_index_type::iterator_type_list, Chris@16: IteratorType>::value|| Chris@16: mpl::contains< Chris@16: BOOST_DEDUCED_TYPENAME multi_index_type::const_iterator_type_list, Chris@16: IteratorType>::value)); Chris@16: #endif Chris@16: Chris@16: BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); Chris@16: Chris@16: #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) Chris@16: typedef detail::converter< Chris@16: multi_index_type, Chris@16: BOOST_DEDUCED_TYPENAME IteratorType::container_type> converter; Chris@16: BOOST_MULTI_INDEX_CHECK_IS_OWNER(it,converter::index(m)); Chris@16: #endif Chris@16: Chris@101: return detail::converter::const_iterator( Chris@16: m,static_cast(it.get_node())); Chris@16: } Chris@16: Chris@16: /* projection of iterators by tag */ Chris@16: Chris@16: template Chris@16: struct index_iterator Chris@16: { Chris@16: typedef typename ::boost::multi_index::index< Chris@16: MultiIndexContainer,Tag>::type::iterator type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct index_const_iterator Chris@16: { Chris@16: typedef typename ::boost::multi_index::index< Chris@16: MultiIndexContainer,Tag>::type::const_iterator type; Chris@16: }; Chris@16: Chris@16: template< Chris@16: typename Tag,typename IteratorType, Chris@16: typename Value,typename IndexSpecifierList,typename Allocator> Chris@16: typename index_iterator< Chris@16: multi_index_container,Tag>::type Chris@16: project( Chris@16: multi_index_container& m, Chris@101: IteratorType it) Chris@16: { Chris@16: typedef multi_index_container< Chris@16: Value,IndexSpecifierList,Allocator> multi_index_type; Chris@16: typedef typename ::boost::multi_index::index< Chris@101: multi_index_type,Tag>::type index_type; Chris@16: Chris@101: #if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* Sun C++ 5.7 fails */ Chris@16: BOOST_STATIC_ASSERT(( Chris@16: mpl::contains< Chris@16: BOOST_DEDUCED_TYPENAME multi_index_type::iterator_type_list, Chris@16: IteratorType>::value)); Chris@16: #endif Chris@16: Chris@16: BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); Chris@16: Chris@16: #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) Chris@16: typedef detail::converter< Chris@16: multi_index_type, Chris@16: BOOST_DEDUCED_TYPENAME IteratorType::container_type> converter; Chris@16: BOOST_MULTI_INDEX_CHECK_IS_OWNER(it,converter::index(m)); Chris@16: #endif Chris@16: Chris@101: return detail::converter::iterator( Chris@16: m,static_cast(it.get_node())); Chris@16: } Chris@16: Chris@16: template< Chris@16: typename Tag,typename IteratorType, Chris@16: typename Value,typename IndexSpecifierList,typename Allocator> Chris@16: typename index_const_iterator< Chris@16: multi_index_container,Tag>::type Chris@16: project( Chris@16: const multi_index_container& m, Chris@101: IteratorType it) Chris@16: { Chris@16: typedef multi_index_container< Chris@16: Value,IndexSpecifierList,Allocator> multi_index_type; Chris@16: typedef typename ::boost::multi_index::index< Chris@101: multi_index_type,Tag>::type index_type; Chris@16: Chris@101: #if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* Sun C++ 5.7 fails */ Chris@16: BOOST_STATIC_ASSERT(( Chris@16: mpl::contains< Chris@16: BOOST_DEDUCED_TYPENAME multi_index_type::iterator_type_list, Chris@16: IteratorType>::value|| Chris@16: mpl::contains< Chris@16: BOOST_DEDUCED_TYPENAME multi_index_type::const_iterator_type_list, Chris@16: IteratorType>::value)); Chris@16: #endif Chris@16: Chris@16: BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); Chris@16: Chris@16: #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) Chris@16: typedef detail::converter< Chris@16: multi_index_type, Chris@16: BOOST_DEDUCED_TYPENAME IteratorType::container_type> converter; Chris@16: BOOST_MULTI_INDEX_CHECK_IS_OWNER(it,converter::index(m)); Chris@16: #endif Chris@16: Chris@101: return detail::converter::const_iterator( Chris@16: m,static_cast(it.get_node())); Chris@16: } Chris@16: Chris@16: /* Comparison. Simple forward to first index. */ Chris@16: Chris@16: template< Chris@16: typename Value1,typename IndexSpecifierList1,typename Allocator1, Chris@16: typename Value2,typename IndexSpecifierList2,typename Allocator2 Chris@16: > Chris@16: bool operator==( Chris@16: const multi_index_container& x, Chris@16: const multi_index_container& y) Chris@16: { Chris@16: return get<0>(x)==get<0>(y); Chris@16: } Chris@16: Chris@16: template< Chris@16: typename Value1,typename IndexSpecifierList1,typename Allocator1, Chris@16: typename Value2,typename IndexSpecifierList2,typename Allocator2 Chris@16: > Chris@16: bool operator<( Chris@16: const multi_index_container& x, Chris@16: const multi_index_container& y) Chris@16: { Chris@16: return get<0>(x)(y); Chris@16: } Chris@16: Chris@16: template< Chris@16: typename Value1,typename IndexSpecifierList1,typename Allocator1, Chris@16: typename Value2,typename IndexSpecifierList2,typename Allocator2 Chris@16: > Chris@16: bool operator!=( Chris@16: const multi_index_container& x, Chris@16: const multi_index_container& y) Chris@16: { Chris@16: return get<0>(x)!=get<0>(y); Chris@16: } Chris@16: Chris@16: template< Chris@16: typename Value1,typename IndexSpecifierList1,typename Allocator1, Chris@16: typename Value2,typename IndexSpecifierList2,typename Allocator2 Chris@16: > Chris@16: bool operator>( Chris@16: const multi_index_container& x, Chris@16: const multi_index_container& y) Chris@16: { Chris@16: return get<0>(x)>get<0>(y); Chris@16: } Chris@16: Chris@16: template< Chris@16: typename Value1,typename IndexSpecifierList1,typename Allocator1, Chris@16: typename Value2,typename IndexSpecifierList2,typename Allocator2 Chris@16: > Chris@16: bool operator>=( Chris@16: const multi_index_container& x, Chris@16: const multi_index_container& y) Chris@16: { Chris@16: return get<0>(x)>=get<0>(y); Chris@16: } Chris@16: Chris@16: template< Chris@16: typename Value1,typename IndexSpecifierList1,typename Allocator1, Chris@16: typename Value2,typename IndexSpecifierList2,typename Allocator2 Chris@16: > Chris@16: bool operator<=( Chris@16: const multi_index_container& x, Chris@16: const multi_index_container& y) Chris@16: { Chris@16: return get<0>(x)<=get<0>(y); Chris@16: } Chris@16: Chris@16: /* specialized algorithms */ Chris@16: Chris@16: template Chris@16: void swap( Chris@16: multi_index_container& x, Chris@16: multi_index_container& y) Chris@16: { Chris@16: x.swap(y); Chris@16: } Chris@16: Chris@16: } /* namespace multi_index */ Chris@16: Chris@101: #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) Chris@16: /* class version = 1 : we now serialize the size through Chris@16: * boost::serialization::collection_size_type. Chris@16: * class version = 2 : proper use of {save|load}_construct_data. Chris@16: */ Chris@16: Chris@16: namespace serialization { Chris@16: template Chris@16: struct version< Chris@16: boost::multi_index_container Chris@16: > Chris@16: { Chris@16: BOOST_STATIC_CONSTANT(int,value=2); Chris@16: }; Chris@16: } /* namespace serialization */ Chris@16: #endif Chris@16: Chris@16: /* Associated global functions are promoted to namespace boost, except Chris@16: * comparison operators and swap, which are meant to be Koenig looked-up. Chris@16: */ Chris@16: Chris@16: using multi_index::get; Chris@16: using multi_index::project; Chris@16: Chris@16: } /* namespace boost */ Chris@16: Chris@16: #undef BOOST_MULTI_INDEX_CHECK_INVARIANT Chris@16: #undef BOOST_MULTI_INDEX_CHECK_INVARIANT_OF Chris@16: Chris@16: #endif