Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81256 - in trunk: boost/bimap boost/bimap/detail boost/bimap/support boost/bimap/views libs/bimap/test
From: matias.capeletto_at_[hidden]
Date: 2012-11-08 18:16:08


Author: matias
Date: 2012-11-08 18:16:06 EST (Thu, 08 Nov 2012)
New Revision: 81256
URL: http://svn.boost.org/trac/boost/changeset/81256

Log:
Refactor map_view_iterator to improve error messages
Text files modified:
   trunk/boost/bimap/bimap.hpp | 53 +++--
   trunk/boost/bimap/detail/bimap_core.hpp | 45 -----
   trunk/boost/bimap/detail/map_view_base.hpp | 53 ++---
   trunk/boost/bimap/detail/map_view_iterator.hpp | 331 ++++++++++++++++++++++++++++-----------
   trunk/boost/bimap/support/iterator_type_by.hpp | 122 ++------------
   trunk/boost/bimap/views/list_map_view.hpp | 25 +-
   trunk/boost/bimap/views/map_view.hpp | 4
   trunk/boost/bimap/views/multimap_view.hpp | 4
   trunk/boost/bimap/views/unconstrained_map_view.hpp | 2
   trunk/boost/bimap/views/unordered_map_view.hpp | 4
   trunk/boost/bimap/views/unordered_multimap_view.hpp | 4
   trunk/boost/bimap/views/vector_map_view.hpp | 6
   trunk/libs/bimap/test/test_bimap_extra.cpp | 12 +
   13 files changed, 340 insertions(+), 325 deletions(-)

Modified: trunk/boost/bimap/bimap.hpp
==============================================================================
--- trunk/boost/bimap/bimap.hpp (original)
+++ trunk/boost/bimap/bimap.hpp 2012-11-08 18:16:06 EST (Thu, 08 Nov 2012)
@@ -166,28 +166,37 @@
     /*
     // The rest is computed in the core, because it is quite difficult to
     // expose a nice interface with so many metaprogramming stuff.
- // Here it is the complete metadat list.
-
+
     // Map by {side} metadata
 
     typedef -unspecified- {side}_tag;
     typedef -unspecified- {side}_data_type;
     typedef -unspecified- {side}_value_type;
     typedef -unspecified- {side}_key_type;
- typedef -unspecified- {side}_iterator;
- typedef -unspecified- {side}_const_iterator;
-
+
+ // There are other typedefs for definitions of different map views
+
     ------------------------------------------------------------------*/
 
     typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::detail::
           left_map_view_type<base_>::type left_map;
     typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::detail::
          right_map_view_type<base_>::type right_map;
+
+ typedef BOOST_DEDUCED_TYPENAME
+ left_map::iterator left_iterator;
+ typedef BOOST_DEDUCED_TYPENAME
+ left_map::const_iterator left_const_iterator;
+
+ typedef BOOST_DEDUCED_TYPENAME
+ right_map::iterator right_iterator;
+ typedef BOOST_DEDUCED_TYPENAME
+ right_map::const_iterator right_const_iterator;
 
     typedef BOOST_DEDUCED_TYPENAME
- left_map::reference left_reference;
+ left_map::reference left_reference;
     typedef BOOST_DEDUCED_TYPENAME
- left_map::const_reference left_const_reference;
+ left_map::const_reference left_const_reference;
 
     typedef BOOST_DEDUCED_TYPENAME
         right_map::reference right_reference;
@@ -239,16 +248,19 @@
          const allocator_type& al = allocator_type()) :
 
        base_::relation_set(
- ::boost::multi_index::get<logic_relation_set_tag>(core)
+ ::boost::multi_index::get<
+ BOOST_DEDUCED_TYPENAME base_::logic_relation_set_tag>(core)
        ),
 
        core(first,last,ctor_args_list(),al),
 
        left (
- ::boost::multi_index::get<logic_left_tag>(core)
+ ::boost::multi_index::get<
+ BOOST_DEDUCED_TYPENAME base_::logic_left_tag>(core)
        ),
        right (
- ::boost::multi_index::get<logic_right_tag>(core)
+ ::boost::multi_index::get<
+ BOOST_DEDUCED_TYPENAME base_::logic_right_tag>(core)
        )
 
    {}
@@ -256,16 +268,19 @@
    bimap(const bimap& x) :
 
        base_::relation_set(
- ::boost::multi_index::get<logic_relation_set_tag>(core)
+ ::boost::multi_index::get<
+ BOOST_DEDUCED_TYPENAME base_::logic_relation_set_tag>(core)
        ),
 
        core(x.core),
 
        left (
- ::boost::multi_index::get<logic_left_tag>(core)
+ ::boost::multi_index::get<
+ BOOST_DEDUCED_TYPENAME base_::logic_left_tag>(core)
        ),
        right (
- ::boost::multi_index::get<logic_right_tag>(core)
+ ::boost::multi_index::get<
+ BOOST_DEDUCED_TYPENAME base_::logic_right_tag>(core)
        )
 
    {}
@@ -279,32 +294,28 @@
     // Projection of iterators
 
     template< class IteratorType >
- BOOST_DEDUCED_TYPENAME base_::left_iterator
- project_left(IteratorType iter)
+ left_iterator project_left(IteratorType iter)
     {
         return core.template project<
             BOOST_DEDUCED_TYPENAME base_::logic_left_tag>(iter.base());
     }
 
     template< class IteratorType >
- BOOST_DEDUCED_TYPENAME base_::left_const_iterator
- project_left(IteratorType iter) const
+ left_const_iterator project_left(IteratorType iter) const
     {
         return core.template project<
             BOOST_DEDUCED_TYPENAME base_::logic_left_tag>(iter.base());
     }
 
     template< class IteratorType >
- BOOST_DEDUCED_TYPENAME base_::right_iterator
- project_right(IteratorType iter)
+ right_iterator project_right(IteratorType iter)
     {
         return core.template project<
             BOOST_DEDUCED_TYPENAME base_::logic_right_tag>(iter.base());
     }
 
     template< class IteratorType >
- BOOST_DEDUCED_TYPENAME base_::right_const_iterator
- project_right(IteratorType iter) const
+ right_const_iterator project_right(IteratorType iter) const
     {
         return core.template project<
             BOOST_DEDUCED_TYPENAME base_::logic_right_tag>(iter.base());

Modified: trunk/boost/bimap/detail/bimap_core.hpp
==============================================================================
--- trunk/boost/bimap/detail/bimap_core.hpp (original)
+++ trunk/boost/bimap/detail/bimap_core.hpp 2012-11-08 18:16:06 EST (Thu, 08 Nov 2012)
@@ -425,50 +425,6 @@
     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 @@
>::type type;
 };
 
+
 } // namespace detail
 } // namespace bimaps
 } // namespace boost

Modified: trunk/boost/bimap/detail/map_view_base.hpp
==============================================================================
--- trunk/boost/bimap/detail/map_view_base.hpp (original)
+++ trunk/boost/bimap/detail/map_view_base.hpp 2012-11-08 18:16:06 EST (Thu, 08 Nov 2012)
@@ -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 @@
 // 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 @@
 {
     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 @@
            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:
 
@@ -263,8 +252,8 @@
     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 +268,8 @@
     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 +284,8 @@
     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 +330,8 @@
     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() )

Modified: trunk/boost/bimap/detail/map_view_iterator.hpp
==============================================================================
--- trunk/boost/bimap/detail/map_view_iterator.hpp (original)
+++ trunk/boost/bimap/detail/map_view_iterator.hpp 2012-11-08 18:16:06 EST (Thu, 08 Nov 2012)
@@ -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 {
 
-#ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
+/** \brief Map View Iterator adaptors from multi index to bimap.
 
-template< class Tag, class Relation, class CoreIterator > struct map_view_iterator;
+These classes are based on transform iterators from Boost.Iterator.
+ **/
 
-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
+template< class Tag, class BimapCore > struct map_view_iterator ;
+template< class Tag, class BimapCore > struct const_map_view_iterator ;
 
- > type;
-};
-
-#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
+template< class Tag, class BimapCore > struct reverse_map_view_iterator ;
+template< class Tag, class BimapCore > struct const_reverse_map_view_iterator ;
 
-/** \brief Map View Iterator adaptor from multi index to bimap.
+template< class Tag, class BimapCore > struct local_map_view_iterator ;
+template< class Tag, class BimapCore > struct const_local_map_view_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.
 
- **/
+#ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
 
-template< class Tag, class Relation, class CoreIterator >
-struct map_view_iterator : public map_view_iterator_base<Tag,Relation,CoreIterator>::type
+#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
+
+/*===========================================================================*/
+#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 \
+)
+/*===========================================================================*/
+
+
+BOOST_BIMAP_CORE_ITERATOR_TYPE_BY_BUILDER( core_iterator_type_by
+ , iterator )
+
+BOOST_BIMAP_CORE_ITERATOR_TYPE_BY_BUILDER( reverse_core_iterator_type_by
+ , reverse_iterator )
+
+BOOST_BIMAP_CORE_ITERATOR_TYPE_BY_BUILDER( local_core_iterator_type_by
+ , local_iterator )
+
+
+// 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_base<Tag,Relation,CoreIterator>::type base_;
-
+ 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 @@
             )
         );
     }
-
     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) 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)
+ 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) 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)
+ 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

Modified: trunk/boost/bimap/support/iterator_type_by.hpp
==============================================================================
--- trunk/boost/bimap/support/iterator_type_by.hpp (original)
+++ trunk/boost/bimap/support/iterator_type_by.hpp 2012-11-08 18:16:06 EST (Thu, 08 Nov 2012)
@@ -21,14 +21,11 @@
 #include <boost/bimap/relation/detail/metadata_access_builder.hpp>
 #include <boost/bimap/relation/detail/static_access_builder.hpp>
 
-#include <boost/bimap/relation/support/pair_type_by.hpp>
-
-#include <boost/bimap/detail/map_view_iterator.hpp>
-
 /** \struct boost::bimaps::support::iterator_type_by
 
 \brief Metafunction to obtain the iterator type of the map view by one of the sides.
-
+These metafunctions can be used outside the bimap framework for other bimap
+signature compatible classes.
 \code
 
 template< class Tag, class Bimap >
@@ -79,7 +76,6 @@
 namespace bimaps {
 namespace support {
 
-
 // Implementation of iterator type by metafunction
 
 BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER
@@ -101,123 +97,41 @@
 
 // Implementation of reverse iterator type by metafunction
 
-BOOST_BIMAP_SYMMETRIC_STATIC_ACCESS_BUILDER
+BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER
 (
- core_reverse_iterator_type_by,
- BimapCore,
-
- typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE
- index<BOOST_DEDUCED_TYPENAME BimapCore::left_tag>
- ::type::reverse_iterator type,
-
- typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE
- index<BOOST_DEDUCED_TYPENAME BimapCore::right_tag>
- ::type::reverse_iterator type
+ reverse_iterator_type_by,
+ left_reverse_iterator,
+ right_reverse_iterator
 )
 
-template< class Tag, class BimapCore >
-struct reverse_iterator_type_by
-{
- typedef ::boost::bimaps::detail::map_view_iterator
- <
- Tag,
- BOOST_DEDUCED_TYPENAME BimapCore::relation,
- BOOST_DEDUCED_TYPENAME core_reverse_iterator_type_by<Tag,BimapCore>::type
-
- > type;
-};
-
 // Implementation of const reverse iterator type by metafunction
 
-BOOST_BIMAP_SYMMETRIC_STATIC_ACCESS_BUILDER
+BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER
 (
- core_const_reverse_iterator_type_by,
- BimapCore,
-
- typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE
- index<BOOST_DEDUCED_TYPENAME BimapCore::left_tag>
- ::type::const_reverse_iterator type,
-
- typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE
- index<BOOST_DEDUCED_TYPENAME BimapCore::right_tag>
- ::type::const_reverse_iterator type
+ const_reverse_iterator_type_by,
+ left_const_reverse_iterator,
+ right_const_reverse_iterator
 )
 
-template< class Tag, class BimapCore >
-struct const_reverse_iterator_type_by
-{
-
- typedef ::boost::bimaps::detail::map_view_iterator
- <
- Tag,
- BOOST_DEDUCED_TYPENAME BimapCore::relation,
- BOOST_DEDUCED_TYPENAME core_const_reverse_iterator_type_by<Tag,BimapCore>::type
-
- > type;
-};
-
 
 // Implementation of local iterator type by metafunction
 
-BOOST_BIMAP_SYMMETRIC_STATIC_ACCESS_BUILDER
+BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER
 (
- core_local_iterator_type_by,
- BimapCore,
-
- typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE
- index<BOOST_DEDUCED_TYPENAME BimapCore::left_tag>
- ::type::local_iterator type,
-
- typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE
- index<BOOST_DEDUCED_TYPENAME BimapCore::right_tag>
- ::type::local_iterator type
+ local_iterator_type_by,
+ left_local_iterator,
+ right_local_iterator
 )
 
-
-template< class Tag, class BimapCore >
-struct local_iterator_type_by
-{
-
- typedef ::boost::bimaps::detail::map_view_iterator
- <
- Tag,
- BOOST_DEDUCED_TYPENAME BimapCore::relation,
- BOOST_DEDUCED_TYPENAME core_local_iterator_type_by<Tag,BimapCore>::type
-
- > type;
-};
-
-
 // Implementation of const local iterator type by metafunction
 
-BOOST_BIMAP_SYMMETRIC_STATIC_ACCESS_BUILDER
+BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER
 (
- core_const_local_iterator_type_by,
- BimapCore,
-
- typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE
- index<BOOST_DEDUCED_TYPENAME BimapCore::left_tag>
- ::type::const_local_iterator type,
-
- typedef BOOST_DEDUCED_TYPENAME BimapCore::core_type::BOOST_NESTED_TEMPLATE
- index<BOOST_DEDUCED_TYPENAME BimapCore::right_tag>
- ::type::const_local_iterator type
+ const_local_iterator_type_by,
+ left_const_local_iterator,
+ right_const_local_iterator
 )
 
-template< class Tag, class BimapCore >
-struct const_local_iterator_type_by
-{
-
- typedef ::boost::bimaps::detail::map_view_iterator
- <
- Tag,
- BOOST_DEDUCED_TYPENAME BimapCore::relation,
- BOOST_DEDUCED_TYPENAME core_const_local_iterator_type_by<Tag,BimapCore>::type
-
- > type;
-};
-
-
 } // namespace support
 } // namespace bimaps
 } // namespace boost

Modified: trunk/boost/bimap/views/list_map_view.hpp
==============================================================================
--- trunk/boost/bimap/views/list_map_view.hpp (original)
+++ trunk/boost/bimap/views/list_map_view.hpp 2012-11-08 18:16:06 EST (Thu, 08 Nov 2012)
@@ -36,22 +36,17 @@
 {
     typedef ::boost::bimaps::container_adaptor::list_map_adaptor
     <
- BOOST_DEDUCED_TYPENAME BimapType::core_type::BOOST_NESTED_TEMPLATE index<Tag>::type,
- 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_DEDUCED_TYPENAME ::boost::bimaps::support::
- reverse_iterator_type_by<Tag,BimapType>::type,
- BOOST_DEDUCED_TYPENAME ::boost::bimaps::support::
- const_reverse_iterator_type_by<Tag,BimapType>::type,
+ BOOST_DEDUCED_TYPENAME BimapType::core_type::
+ BOOST_NESTED_TEMPLATE index<Tag>::type,
+ ::boost::bimaps::detail:: map_view_iterator<Tag,BimapType>,
+ ::boost::bimaps::detail:: const_map_view_iterator<Tag,BimapType>,
+ ::boost::bimaps::detail:: reverse_map_view_iterator<Tag,BimapType>,
+ ::boost::bimaps::detail::const_reverse_map_view_iterator<Tag,BimapType>,
         ::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>
+
>,
         ::boost::mpl::na,
         ::boost::mpl::na,
@@ -64,7 +59,7 @@
         <
             Tag,
             BOOST_DEDUCED_TYPENAME BimapType::relation
-
+
>::type
 
> type;

Modified: trunk/boost/bimap/views/map_view.hpp
==============================================================================
--- trunk/boost/bimap/views/map_view.hpp (original)
+++ trunk/boost/bimap/views/map_view.hpp 2012-11-08 18:16:06 EST (Thu, 08 Nov 2012)
@@ -40,7 +40,7 @@
     public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
         map_adaptor,
         Tag,BimapType,
- reverse_iterator_type_by,const_reverse_iterator_type_by
+ reverse_map_view_iterator,const_reverse_map_view_iterator
     ),
     public ::boost::bimaps::detail::
         map_view_base< map_view<Tag,BimapType>,Tag,BimapType >,
@@ -50,7 +50,7 @@
     typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
         map_adaptor,
         Tag,BimapType,
- reverse_iterator_type_by,const_reverse_iterator_type_by
+ reverse_map_view_iterator,const_reverse_map_view_iterator
 
     ) base_;
 

Modified: trunk/boost/bimap/views/multimap_view.hpp
==============================================================================
--- trunk/boost/bimap/views/multimap_view.hpp (original)
+++ trunk/boost/bimap/views/multimap_view.hpp 2012-11-08 18:16:06 EST (Thu, 08 Nov 2012)
@@ -42,7 +42,7 @@
     public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
         multimap_adaptor,
         Tag,BimapType,
- reverse_iterator_type_by,const_reverse_iterator_type_by
+ reverse_map_view_iterator,const_reverse_map_view_iterator
     ),
     public ::boost::bimaps::detail::
                 map_view_base< multimap_view<Tag,BimapType>,Tag,BimapType >
@@ -51,7 +51,7 @@
     typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
         multimap_adaptor,
         Tag,BimapType,
- reverse_iterator_type_by,const_reverse_iterator_type_by
+ reverse_map_view_iterator,const_reverse_map_view_iterator
 
     ) base_;
 

Modified: trunk/boost/bimap/views/unconstrained_map_view.hpp
==============================================================================
--- trunk/boost/bimap/views/unconstrained_map_view.hpp (original)
+++ trunk/boost/bimap/views/unconstrained_map_view.hpp 2012-11-08 18:16:06 EST (Thu, 08 Nov 2012)
@@ -31,6 +31,8 @@
     template< class T >
     unconstrained_map_view(const T &) {}
 
+ typedef void iterator;
+ typedef void const_iterator;
     typedef void reference;
     typedef void const_reference;
     typedef void info_type;

Modified: trunk/boost/bimap/views/unordered_map_view.hpp
==============================================================================
--- trunk/boost/bimap/views/unordered_map_view.hpp (original)
+++ trunk/boost/bimap/views/unordered_map_view.hpp 2012-11-08 18:16:06 EST (Thu, 08 Nov 2012)
@@ -43,7 +43,7 @@
     public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
         unordered_map_adaptor,
         Tag,BimapType,
- local_iterator_type_by,const_local_iterator_type_by
+ local_map_view_iterator,const_local_map_view_iterator
     ),
 
     public ::boost::bimaps::detail::map_view_base<
@@ -56,7 +56,7 @@
     typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
         unordered_map_adaptor,
         Tag,BimapType,
- local_iterator_type_by,const_local_iterator_type_by
+ local_map_view_iterator,const_local_map_view_iterator
 
     ) base_;
 

Modified: trunk/boost/bimap/views/unordered_multimap_view.hpp
==============================================================================
--- trunk/boost/bimap/views/unordered_multimap_view.hpp (original)
+++ trunk/boost/bimap/views/unordered_multimap_view.hpp 2012-11-08 18:16:06 EST (Thu, 08 Nov 2012)
@@ -44,7 +44,7 @@
     public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
         unordered_multimap_adaptor,
         Tag,BimapType,
- local_iterator_type_by,const_local_iterator_type_by
+ local_map_view_iterator,const_local_map_view_iterator
     ),
 
     public ::boost::bimaps::detail::map_view_base<
@@ -54,7 +54,7 @@
     typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
         unordered_multimap_adaptor,
         Tag,BimapType,
- local_iterator_type_by,const_local_iterator_type_by
+ local_map_view_iterator,const_local_map_view_iterator
 
     ) base_;
 

Modified: trunk/boost/bimap/views/vector_map_view.hpp
==============================================================================
--- trunk/boost/bimap/views/vector_map_view.hpp (original)
+++ trunk/boost/bimap/views/vector_map_view.hpp 2012-11-08 18:16:06 EST (Thu, 08 Nov 2012)
@@ -41,7 +41,7 @@
     public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
         vector_map_adaptor,
         Tag,BimapType,
- reverse_iterator_type_by, const_reverse_iterator_type_by
+ reverse_map_view_iterator, const_reverse_map_view_iterator
     ),
 
     public ::boost::bimaps::detail::
@@ -50,7 +50,7 @@
     typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
         vector_map_adaptor,
         Tag,BimapType,
- reverse_iterator_type_by, const_reverse_iterator_type_by
+ reverse_map_view_iterator, const_reverse_map_view_iterator
 
     ) base_;
 
@@ -273,7 +273,7 @@
 /*===========================================================================*/
 #define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(MAP_VIEW,SIDE) \
     BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,reverse_iterator) \
- BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_reverse_iterator) \
+ BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_reverse_iterator)
 /*===========================================================================*/
 
 namespace detail {

Modified: trunk/libs/bimap/test/test_bimap_extra.cpp
==============================================================================
--- trunk/libs/bimap/test/test_bimap_extra.cpp (original)
+++ trunk/libs/bimap/test/test_bimap_extra.cpp 2012-11-08 18:16:06 EST (Thu, 08 Nov 2012)
@@ -34,13 +34,14 @@
 #include <boost/bimap/support/map_type_by.hpp>
 #include <boost/bimap/support/value_type_by.hpp>
 #include <boost/bimap/support/iterator_type_by.hpp>
+#include <boost/bimap/relation/support/pair_type_by.hpp>
 
 using namespace boost::bimaps;
 using namespace boost::bimaps::support;
+using namespace boost::bimaps::relation::support ;
 
 typedef bimap<int, unconstrained_set_of<double> > bm_type;
 
-
 namespace support_metafunctions_test {
 
     typedef boost::is_same
@@ -67,6 +68,15 @@
>::type test_metafunction_3;
     BOOST_STATIC_ASSERT(test_metafunction_3::value);
 
+ typedef boost::is_same
+ <
+ pair_type_by< member_at::left,
+ BOOST_DEDUCED_TYPENAME bm_type::relation>::type,
+ value_type_by< member_at::left , bm_type >::type
+
+ >::type test_metafunction_4;
+ BOOST_STATIC_ASSERT(test_metafunction_4::value);
+
 } // namespace support_metafunctions_test
 
 void test_bimap_extra()


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk