diff options
Diffstat (limited to 'boost/bimap/detail')
17 files changed, 266 insertions, 181 deletions
diff --git a/boost/bimap/detail/bimap_core.hpp b/boost/bimap/detail/bimap_core.hpp index f37d968105..28a91a4631 100644 --- a/boost/bimap/detail/bimap_core.hpp +++ b/boost/bimap/detail/bimap_core.hpp @@ -425,50 +425,6 @@ class bimap_core typedef BOOST_DEDUCED_TYPENAME right_index::iterator right_core_iterator; typedef BOOST_DEDUCED_TYPENAME right_index::const_iterator right_core_const_iterator; - // Map by {side} iterator metadata - // -------------------------------------------------------------------- - public: - - //@{ - - typedef ::boost::bimaps::detail::map_view_iterator - < - left_tag, - relation, - left_core_iterator - - > left_iterator; - - typedef ::boost::bimaps::detail::map_view_iterator - < - right_tag, - relation, - right_core_iterator - - > right_iterator; - - //@} - - //@{ - - typedef ::boost::bimaps::detail::const_map_view_iterator - < - left_tag, - relation, - left_core_const_iterator - - > left_const_iterator; - - typedef ::boost::bimaps::detail::const_map_view_iterator - < - right_tag, - relation, - right_core_const_iterator - - > right_const_iterator; - - //@} - // Relation set view typedef BOOST_DEDUCED_TYPENAME ::boost::multi_index::index @@ -513,6 +469,7 @@ struct right_map_view_type >::type type; }; + } // namespace detail } // namespace bimaps } // namespace boost diff --git a/boost/bimap/detail/concept_tags.hpp b/boost/bimap/detail/concept_tags.hpp index 1f252e3092..1f252e3092 100644..100755 --- a/boost/bimap/detail/concept_tags.hpp +++ b/boost/bimap/detail/concept_tags.hpp diff --git a/boost/bimap/detail/debug/static_error.hpp b/boost/bimap/detail/debug/static_error.hpp index 3a8ed632ae..3a8ed632ae 100644..100755 --- a/boost/bimap/detail/debug/static_error.hpp +++ b/boost/bimap/detail/debug/static_error.hpp diff --git a/boost/bimap/detail/generate_index_binder.hpp b/boost/bimap/detail/generate_index_binder.hpp index 01c899d4d8..01c899d4d8 100644..100755 --- a/boost/bimap/detail/generate_index_binder.hpp +++ b/boost/bimap/detail/generate_index_binder.hpp diff --git a/boost/bimap/detail/generate_relation_binder.hpp b/boost/bimap/detail/generate_relation_binder.hpp index 0ff47621bd..0ff47621bd 100644..100755 --- a/boost/bimap/detail/generate_relation_binder.hpp +++ b/boost/bimap/detail/generate_relation_binder.hpp diff --git a/boost/bimap/detail/generate_view_binder.hpp b/boost/bimap/detail/generate_view_binder.hpp index 925184cff7..925184cff7 100644..100755 --- a/boost/bimap/detail/generate_view_binder.hpp +++ b/boost/bimap/detail/generate_view_binder.hpp diff --git a/boost/bimap/detail/is_set_type_of.hpp b/boost/bimap/detail/is_set_type_of.hpp index 13d52c1d04..13d52c1d04 100644..100755 --- a/boost/bimap/detail/is_set_type_of.hpp +++ b/boost/bimap/detail/is_set_type_of.hpp diff --git a/boost/bimap/detail/manage_additional_parameters.hpp b/boost/bimap/detail/manage_additional_parameters.hpp index 3d22d730e7..3d22d730e7 100644..100755 --- a/boost/bimap/detail/manage_additional_parameters.hpp +++ b/boost/bimap/detail/manage_additional_parameters.hpp diff --git a/boost/bimap/detail/manage_bimap_key.hpp b/boost/bimap/detail/manage_bimap_key.hpp index d485e50aee..d485e50aee 100644..100755 --- a/boost/bimap/detail/manage_bimap_key.hpp +++ b/boost/bimap/detail/manage_bimap_key.hpp diff --git a/boost/bimap/detail/map_view_base.hpp b/boost/bimap/detail/map_view_base.hpp index 7900901bfb..51059c38c4 100644 --- a/boost/bimap/detail/map_view_base.hpp +++ b/boost/bimap/detail/map_view_base.hpp @@ -31,12 +31,13 @@ #include <boost/bimap/relation/support/data_extractor.hpp> #include <boost/bimap/relation/support/opposite_tag.hpp> #include <boost/bimap/relation/support/pair_type_by.hpp> -#include <boost/bimap/support/iterator_type_by.hpp> +//#include <boost/bimap/support/iterator_type_by.hpp> #include <boost/bimap/support/key_type_by.hpp> #include <boost/bimap/support/data_type_by.hpp> #include <boost/bimap/support/value_type_by.hpp> #include <boost/bimap/detail/modifier_adaptor.hpp> #include <boost/bimap/detail/debug/static_error.hpp> +#include <boost/bimap/detail/map_view_iterator.hpp> namespace boost { namespace bimaps { @@ -47,27 +48,20 @@ namespace detail { // The next macro can be converted in a metafunctor to gain code robustness. /*===========================================================================*/ #define BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR( \ - CONTAINER_ADAPTOR, TAG,BIMAP, OTHER_ITER, CONST_OTHER_ITER \ + CONTAINER_ADAPTOR, TAG, BIMAP, OTHER_ITER, CONST_OTHER_ITER \ ) \ ::boost::bimaps::container_adaptor::CONTAINER_ADAPTOR \ < \ BOOST_DEDUCED_TYPENAME BIMAP::core_type:: \ BOOST_NESTED_TEMPLATE index<TAG>::type, \ - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: \ - iterator_type_by<TAG,BIMAP>::type, \ - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: \ - const_iterator_type_by<TAG,BIMAP>::type, \ - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: \ - OTHER_ITER<TAG,BIMAP>::type, \ - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: \ - CONST_OTHER_ITER<TAG,BIMAP>::type, \ + ::boost::bimaps::detail:: map_view_iterator<TAG,BIMAP>, \ + ::boost::bimaps::detail::const_map_view_iterator<TAG,BIMAP>, \ + ::boost::bimaps::detail:: OTHER_ITER<TAG,BIMAP>, \ + ::boost::bimaps::detail::CONST_OTHER_ITER<TAG,BIMAP>, \ ::boost::bimaps::container_adaptor::support::iterator_facade_to_base \ < \ - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: \ - iterator_type_by<TAG,BIMAP>::type, \ - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: \ - const_iterator_type_by<TAG,BIMAP>::type \ - \ + ::boost::bimaps::detail:: map_view_iterator<TAG,BIMAP>, \ + ::boost::bimaps::detail::const_map_view_iterator<TAG,BIMAP> \ >, \ ::boost::mpl::na, \ ::boost::mpl::na, \ @@ -102,13 +96,8 @@ class map_view_base { typedef ::boost::bimaps::container_adaptor::support:: iterator_facade_to_base< - - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - iterator_type_by<Tag,BimapType>::type, - - BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - const_iterator_type_by<Tag,BimapType>::type - + ::boost::bimaps::detail:: map_view_iterator<Tag,BimapType>, + ::boost::bimaps::detail::const_map_view_iterator<Tag,BimapType> > iterator_to_base_; typedef ::boost::bimaps::relation::detail:: @@ -125,8 +114,8 @@ class map_view_base pair_type_by<Tag, BOOST_DEDUCED_TYPENAME BimapType::relation>::type value_type_; - typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - iterator_type_by<Tag,BimapType>::type iterator_; + typedef + ::boost::bimaps::detail::map_view_iterator<Tag,BimapType> iterator_; public: @@ -144,7 +133,8 @@ class map_view_base return derived().base().replace( derived().template functor<iterator_to_base_>()(position), derived().template functor<value_to_base_>()( - value_type_(k,position->second) + ::boost::bimaps::relation::detail:: + copy_with_first_replaced(*position,k) ) ); } @@ -155,7 +145,8 @@ class map_view_base return derived().base().replace( derived().template functor<iterator_to_base_>()(position), derived().template functor<value_to_base_>()( - value_type_(position->first,d) + ::boost::bimaps::relation::detail:: + copy_with_second_replaced(*position,d) ) ); } @@ -263,8 +254,8 @@ class mutable_data_unique_map_view_access template< class CompatibleKey > data_type_ & at(const CompatibleKey& k) { - typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - iterator_type_by<Tag,BimapType>::type iterator; + typedef ::boost::bimaps::detail:: + map_view_iterator<Tag,BimapType> iterator; iterator iter = derived().find(k); if( iter == derived().end() ) @@ -279,8 +270,8 @@ class mutable_data_unique_map_view_access template< class CompatibleKey > const data_type_ & at(const CompatibleKey& k) const { - typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - const_iterator_type_by<Tag,BimapType>::type const_iterator; + typedef ::boost::bimaps::detail:: + const_map_view_iterator<Tag,BimapType> const_iterator; const_iterator iter = derived().find(k); if( iter == derived().end() ) @@ -295,8 +286,8 @@ class mutable_data_unique_map_view_access template< class CompatibleKey > data_type_ & operator[](const CompatibleKey& k) { - typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - iterator_type_by<Tag,BimapType>::type iterator; + typedef ::boost::bimaps::detail:: + map_view_iterator<Tag,BimapType> iterator; typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: value_type_by<Tag,BimapType>::type value_type; @@ -341,8 +332,8 @@ class non_mutable_data_unique_map_view_access template< class CompatibleKey > const data_type_ & at(const CompatibleKey& k) const { - typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::support:: - const_iterator_type_by<Tag,BimapType>::type const_iterator; + typedef ::boost::bimaps::detail:: + const_map_view_iterator<Tag,BimapType> const_iterator; const_iterator iter = derived().find(k); if( iter == derived().end() ) @@ -355,7 +346,7 @@ class non_mutable_data_unique_map_view_access } template< class CompatibleKey > - data_type_ & operator[](const CompatibleKey& k) + data_type_ & operator[](const CompatibleKey&) { BOOST_BIMAP_STATIC_ERROR( OPERATOR_BRACKET_IS_NOT_SUPPORTED, (Derived)); } @@ -493,7 +484,7 @@ void assign(BOOST_DEDUCED_TYPENAME BASE::size_type n, \ const BOOST_DEDUCED_TYPENAME BASE::value_type& v) \ { \ this->clear(); \ - for(BOOST_DEDUCED_TYPENAME BASE::size_type i = 0 ; i < n ; ++n) \ + for(BOOST_DEDUCED_TYPENAME BASE::size_type i = 0 ; i < n ; ++i) \ { \ this->push_back(v); \ } \ diff --git a/boost/bimap/detail/map_view_iterator.hpp b/boost/bimap/detail/map_view_iterator.hpp index 4f0e20e00a..c796a70156 100644 --- a/boost/bimap/detail/map_view_iterator.hpp +++ b/boost/bimap/detail/map_view_iterator.hpp @@ -28,50 +28,101 @@ #include <boost/iterator/iterator_adaptor.hpp> #include <boost/bimap/relation/support/pair_by.hpp> +// check +#include <boost/bimap/relation/detail/metadata_access_builder.hpp> +#include <boost/bimap/relation/detail/static_access_builder.hpp> + namespace boost { namespace bimaps { namespace detail { +/** \brief Map View Iterator adaptors from multi index to bimap. + +These classes are based on transform iterators from Boost.Iterator. + **/ + +template< class Tag, class BimapCore > struct map_view_iterator ; +template< class Tag, class BimapCore > struct const_map_view_iterator ; + +template< class Tag, class BimapCore > struct reverse_map_view_iterator ; +template< class Tag, class BimapCore > struct const_reverse_map_view_iterator ; + +template< class Tag, class BimapCore > struct local_map_view_iterator ; +template< class Tag, class BimapCore > struct const_local_map_view_iterator ; + + #ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES -template< class Tag, class Relation, class CoreIterator > struct map_view_iterator; +#ifndef BOOST_BIMAP_DISABLE_SERIALIZATION +/*===========================================================================*/ +#define BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT \ + BOOST_SERIALIZATION_SPLIT_MEMBER() \ + \ + friend class ::boost::serialization::access; \ + \ + template< class Archive > \ + void save(Archive & ar, const unsigned int) const \ + { \ + ar << ::boost::serialization::make_nvp("mi_iterator",this->base()); \ + } \ + \ + template< class Archive > \ + void load(Archive & ar, const unsigned int) \ + { \ + BOOST_DEDUCED_TYPENAME base_::base_type iter; \ + ar >> ::boost::serialization::make_nvp("mi_iterator",iter); \ + this->base_reference() = iter; \ + } +/*===========================================================================*/ +#else +#define BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT // None +#endif // BOOST_BIMAP_DISABLE_SERIALIZATION -template< class Tag, class Relation, class CoreIterator > -struct map_view_iterator_base -{ - typedef iterator_adaptor - < - map_view_iterator< Tag, Relation, CoreIterator >, - CoreIterator, - BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support:: - pair_type_by<Tag,Relation>::type +/*===========================================================================*/ +#define BOOST_BIMAP_CORE_ITERATOR_TYPE_BY_BUILDER( METANAME, ITERATOR ) \ +BOOST_BIMAP_SYMMETRIC_STATIC_ACCESS_BUILDER( METANAME, BimapCore, \ + typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE\ + index<BOOST_DEDUCED_TYPENAME BimapCore::left_tag> \ + ::type::ITERATOR type, \ + typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE\ + index<BOOST_DEDUCED_TYPENAME BimapCore::right_tag> \ + ::type::ITERATOR type \ +) +/*===========================================================================*/ - > type; -}; -#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES +BOOST_BIMAP_CORE_ITERATOR_TYPE_BY_BUILDER( core_iterator_type_by + , iterator ) -/** \brief Map View Iterator adaptor from multi index to bimap. +BOOST_BIMAP_CORE_ITERATOR_TYPE_BY_BUILDER( reverse_core_iterator_type_by + , reverse_iterator ) -This is class is based on transform iterator from Boost.Iterator that is -modified to allow serialization. It has been specialized for this -library, and EBO optimization was applied to the functor. +BOOST_BIMAP_CORE_ITERATOR_TYPE_BY_BUILDER( local_core_iterator_type_by + , local_iterator ) - **/ -template< class Tag, class Relation, class CoreIterator > -struct map_view_iterator : public map_view_iterator_base<Tag,Relation,CoreIterator>::type -{ - typedef BOOST_DEDUCED_TYPENAME - map_view_iterator_base<Tag,Relation,CoreIterator>::type base_; +// map_view_iterator +template< class Tag, class BimapCore > +struct map_view_iterator_adaptor { + typedef iterator_adaptor< + map_view_iterator<Tag,BimapCore>, + BOOST_DEDUCED_TYPENAME core_iterator_type_by<Tag,BimapCore>::type, + BOOST_DEDUCED_TYPENAME + ::boost::bimaps::support::value_type_by<Tag,BimapCore>::type + > type; +}; +template< class Tag, class BimapCore > +struct map_view_iterator : + public map_view_iterator_adaptor<Tag,BimapCore>::type +{ + typedef BOOST_DEDUCED_TYPENAME + map_view_iterator_adaptor<Tag,BimapCore>::type base_; public: map_view_iterator() {} - - map_view_iterator(CoreIterator const& iter) + map_view_iterator(BOOST_DEDUCED_TYPENAME base_::base_type const& iter) : base_(iter) {} - map_view_iterator(map_view_iterator const & iter) : base_(iter.base()) {} @@ -83,117 +134,203 @@ struct map_view_iterator : public map_view_iterator_base<Tag,Relation,CoreIterat ) ); } - private: - friend class iterator_core_access; + BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT +}; - #ifndef BOOST_BIMAP_DISABLE_SERIALIZATION - - // Serialization support - - BOOST_SERIALIZATION_SPLIT_MEMBER() - friend class ::boost::serialization::access; +template< class Tag, class BimapCore > +struct const_map_view_iterator_adaptor { + typedef iterator_adaptor< + const_map_view_iterator<Tag,BimapCore>, + BOOST_DEDUCED_TYPENAME core_iterator_type_by<Tag,BimapCore>::type, + const BOOST_DEDUCED_TYPENAME + ::boost::bimaps::support::value_type_by<Tag,BimapCore>::type + > type; +}; +template< class Tag, class BimapCore > +struct const_map_view_iterator : + public const_map_view_iterator_adaptor<Tag,BimapCore>::type +{ + typedef BOOST_DEDUCED_TYPENAME + const_map_view_iterator_adaptor<Tag,BimapCore>::type base_; + public: - template< class Archive > - void save(Archive & ar, const unsigned int version) const - { - ar << ::boost::serialization::make_nvp("mi_iterator",this->base()); - } + const_map_view_iterator() {} + const_map_view_iterator( + BOOST_DEDUCED_TYPENAME base_::base_type const& iter) + : base_(iter) {} + const_map_view_iterator(const_map_view_iterator const & iter) + : base_(iter.base()) {} + const_map_view_iterator(map_view_iterator<Tag,BimapCore> i) + : base_(i.base()) {} - template< class Archive > - void load(Archive & ar, const unsigned int version) + BOOST_DEDUCED_TYPENAME base_::reference dereference() const { - CoreIterator iter; - ar >> ::boost::serialization::make_nvp("mi_iterator",iter); - this->base_reference() = iter; + return ::boost::bimaps::relation::support::pair_by<Tag>(*this->base()); } - - #endif // BOOST_BIMAP_DISABLE_SERIALIZATION + private: + friend class iterator_core_access; + BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT }; -#ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES - -template< class Tag, class Relation, class CoreIterator > struct const_map_view_iterator; - -template< class Tag, class Relation, class CoreIterator > -struct const_map_view_iterator_base -{ - typedef iterator_adaptor - < - const_map_view_iterator< Tag, Relation, CoreIterator >, - CoreIterator, - const BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support:: - pair_type_by<Tag,Relation>::type +// reverse_map_view_iterator +template< class Tag, class BimapCore > +struct reverse_map_view_iterator_adaptor { + typedef iterator_adaptor< + reverse_map_view_iterator<Tag,BimapCore>, + BOOST_DEDUCED_TYPENAME + reverse_core_iterator_type_by<Tag,BimapCore>::type, + BOOST_DEDUCED_TYPENAME + ::boost::bimaps::support::value_type_by<Tag,BimapCore>::type > type; }; +template< class Tag, class BimapCore > +struct reverse_map_view_iterator : + public reverse_map_view_iterator_adaptor<Tag,BimapCore>::type +{ + typedef BOOST_DEDUCED_TYPENAME + reverse_map_view_iterator_adaptor<Tag,BimapCore>::type base_; + public: -#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES - - -/** \brief Const Map View Iterator adaptor from multi index to bimap. - -See also map_view_iterator. - **/ + reverse_map_view_iterator() {} + reverse_map_view_iterator( + BOOST_DEDUCED_TYPENAME base_::base_type const& iter) + : base_(iter) {} + reverse_map_view_iterator(reverse_map_view_iterator const & iter) + : base_(iter.base()) {} -template< class Tag, class Relation, class CoreIterator > -struct const_map_view_iterator : + BOOST_DEDUCED_TYPENAME base_::reference dereference() const + { + return ::boost::bimaps::relation::support::pair_by<Tag>( + *const_cast<BOOST_DEDUCED_TYPENAME base_::base_type::value_type*>( + &(*this->base()) + ) + ); + } + private: + friend class iterator_core_access; + BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT +}; - public const_map_view_iterator_base<Tag,Relation,CoreIterator>::type +template< class Tag, class BimapCore > +struct const_reverse_map_view_iterator_adaptor { + typedef iterator_adaptor< + const_reverse_map_view_iterator<Tag,BimapCore>, + BOOST_DEDUCED_TYPENAME + reverse_core_iterator_type_by<Tag,BimapCore>::type, + const BOOST_DEDUCED_TYPENAME + ::boost::bimaps::support::value_type_by<Tag,BimapCore>::type + > type; +}; +template< class Tag, class BimapCore > +struct const_reverse_map_view_iterator : + public const_reverse_map_view_iterator_adaptor<Tag,BimapCore>::type { - typedef BOOST_DEDUCED_TYPENAME - const_map_view_iterator_base<Tag,Relation,CoreIterator>::type base_; - + typedef BOOST_DEDUCED_TYPENAME + const_reverse_map_view_iterator_adaptor<Tag,BimapCore>::type base_; + public: - const_map_view_iterator() {} - - const_map_view_iterator(CoreIterator const& iter) + const_reverse_map_view_iterator() {} + const_reverse_map_view_iterator( + BOOST_DEDUCED_TYPENAME base_::base_type const& iter) : base_(iter) {} - - const_map_view_iterator(const_map_view_iterator const & iter) + const_reverse_map_view_iterator(const_reverse_map_view_iterator const & iter) : base_(iter.base()) {} - - const_map_view_iterator(map_view_iterator<Tag,Relation,CoreIterator> i) + const_reverse_map_view_iterator(reverse_map_view_iterator<Tag,BimapCore> i) : base_(i.base()) {} BOOST_DEDUCED_TYPENAME base_::reference dereference() const { return ::boost::bimaps::relation::support::pair_by<Tag>(*this->base()); } - private: - friend class iterator_core_access; + BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT +}; - #ifndef BOOST_BIMAP_DISABLE_SERIALIZATION - // Serialization support +// local_map_view_iterator - BOOST_SERIALIZATION_SPLIT_MEMBER() +template< class Tag, class BimapCore > +struct local_map_view_iterator_adaptor { + typedef iterator_adaptor< + local_map_view_iterator<Tag,BimapCore>, + BOOST_DEDUCED_TYPENAME + local_core_iterator_type_by<Tag,BimapCore>::type, + BOOST_DEDUCED_TYPENAME + ::boost::bimaps::support::value_type_by<Tag,BimapCore>::type + > type; +}; +template< class Tag, class BimapCore > +struct local_map_view_iterator : + public local_map_view_iterator_adaptor<Tag,BimapCore>::type +{ + typedef BOOST_DEDUCED_TYPENAME + local_map_view_iterator_adaptor<Tag,BimapCore>::type base_; + public: - friend class ::boost::serialization::access; + local_map_view_iterator() {} + local_map_view_iterator( + BOOST_DEDUCED_TYPENAME base_::base_type const& iter) + : base_(iter) {} + local_map_view_iterator(local_map_view_iterator const & iter) + : base_(iter.base()) {} - template< class Archive > - void save(Archive & ar, const unsigned int version) const + BOOST_DEDUCED_TYPENAME base_::reference dereference() const { - ar << ::boost::serialization::make_nvp("mi_iterator",this->base()); + return ::boost::bimaps::relation::support::pair_by<Tag>( + *const_cast<BOOST_DEDUCED_TYPENAME base_::base_type::value_type*>( + &(*this->base()) + ) + ); } + private: + friend class iterator_core_access; + BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT +}; + +template< class Tag, class BimapCore > +struct const_local_map_view_iterator_adaptor { + typedef iterator_adaptor< + const_local_map_view_iterator<Tag,BimapCore>, + BOOST_DEDUCED_TYPENAME + local_core_iterator_type_by<Tag,BimapCore>::type, + const BOOST_DEDUCED_TYPENAME + ::boost::bimaps::support::value_type_by<Tag,BimapCore>::type + > type; +}; +template< class Tag, class BimapCore > +struct const_local_map_view_iterator : + public const_local_map_view_iterator_adaptor<Tag,BimapCore>::type +{ + typedef BOOST_DEDUCED_TYPENAME + const_local_map_view_iterator_adaptor<Tag,BimapCore>::type base_; + public: + + const_local_map_view_iterator() {} + const_local_map_view_iterator( + BOOST_DEDUCED_TYPENAME base_::base_type const& iter) + : base_(iter) {} + const_local_map_view_iterator(const_local_map_view_iterator const & iter) + : base_(iter.base()) {} + const_local_map_view_iterator(local_map_view_iterator<Tag,BimapCore> i) + : base_(i.base()) {} - template< class Archive > - void load(Archive & ar, const unsigned int version) + BOOST_DEDUCED_TYPENAME base_::reference dereference() const { - CoreIterator iter; - ar >> ::boost::serialization::make_nvp("mi_iterator",iter); - this->base_reference() = iter; + return ::boost::bimaps::relation::support::pair_by<Tag>(*this->base()); } - - #endif // BOOST_BIMAP_DISABLE_SERIALIZATION + private: + friend class iterator_core_access; + BOOST_BIMAP_MAP_VIEW_ITERATOR_SERIALIZATION_SUPPORT }; +#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES } // namespace detail } // namespace bimaps diff --git a/boost/bimap/detail/modifier_adaptor.hpp b/boost/bimap/detail/modifier_adaptor.hpp index b170549d08..b170549d08 100644..100755 --- a/boost/bimap/detail/modifier_adaptor.hpp +++ b/boost/bimap/detail/modifier_adaptor.hpp diff --git a/boost/bimap/detail/non_unique_views_helper.hpp b/boost/bimap/detail/non_unique_views_helper.hpp index 6801632019..6801632019 100644..100755 --- a/boost/bimap/detail/non_unique_views_helper.hpp +++ b/boost/bimap/detail/non_unique_views_helper.hpp diff --git a/boost/bimap/detail/set_view_base.hpp b/boost/bimap/detail/set_view_base.hpp index 7c7f0d0a62..45305f0396 100644 --- a/boost/bimap/detail/set_view_base.hpp +++ b/boost/bimap/detail/set_view_base.hpp @@ -199,7 +199,7 @@ class set_view_base { return derived().base().replace( derived().template functor<iterator_to_base_>()(position), - value_type_(l,position->right) + ::boost::bimaps::relation::detail::copy_with_left_replaced(*position,l) ); } @@ -209,7 +209,7 @@ class set_view_base { return derived().base().replace( derived().template functor<iterator_to_base_>()(position), - value_type_(position->left,r) + ::boost::bimaps::relation::detail::copy_with_right_replaced(*position,r) ); } diff --git a/boost/bimap/detail/set_view_iterator.hpp b/boost/bimap/detail/set_view_iterator.hpp index d48f5c05b1..08d7a42b71 100644 --- a/boost/bimap/detail/set_view_iterator.hpp +++ b/boost/bimap/detail/set_view_iterator.hpp @@ -95,13 +95,13 @@ struct set_view_iterator : public set_view_iterator_base<CoreIterator>::type friend class ::boost::serialization::access; template< class Archive > - void save(Archive & ar, const unsigned int version) const + void save(Archive & ar, const unsigned int) const { ar << ::boost::serialization::make_nvp("mi_iterator",this->base()); } template< class Archive > - void load(Archive & ar, const unsigned int version) + void load(Archive & ar, const unsigned int) { CoreIterator iter; ar >> ::boost::serialization::make_nvp("mi_iterator",iter); @@ -171,13 +171,13 @@ struct const_set_view_iterator : public const_set_view_iterator_base<CoreIterato friend class ::boost::serialization::access; template< class Archive > - void save(Archive & ar, const unsigned int version) const + void save(Archive & ar, const unsigned int) const { ar << ::boost::serialization::make_nvp("mi_iterator",this->base()); } template< class Archive > - void load(Archive & ar, const unsigned int version) + void load(Archive & ar, const unsigned int) { CoreIterator iter; ar >> ::boost::serialization::make_nvp("mi_iterator",iter); diff --git a/boost/bimap/detail/test/check_metadata.hpp b/boost/bimap/detail/test/check_metadata.hpp index b669ee082d..b669ee082d 100644..100755 --- a/boost/bimap/detail/test/check_metadata.hpp +++ b/boost/bimap/detail/test/check_metadata.hpp diff --git a/boost/bimap/detail/user_interface_config.hpp b/boost/bimap/detail/user_interface_config.hpp index 1d9a8e8e15..1d9a8e8e15 100644..100755 --- a/boost/bimap/detail/user_interface_config.hpp +++ b/boost/bimap/detail/user_interface_config.hpp |