Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82713 - in trunk/boost/fusion: container/map container/map/detail container/map/detail/cpp03 container/vector container/vector/detail support
From: joel_at_[hidden]
Date: 2013-02-06 20:25:08


Author: djowel
Date: 2013-02-04 01:21:45 EST (Mon, 04 Feb 2013)
New Revision: 82713
URL: http://svn.boost.org/trac/boost/changeset/82713

Log:
More map tests and more API features implemented + tweaks to affected components
Text files modified:
   trunk/boost/fusion/container/map/detail/cpp03/map.hpp | 9 +++++++--
   trunk/boost/fusion/container/map/detail/map_impl.hpp | 11 +++++++++++
   trunk/boost/fusion/container/map/map.hpp | 39 ++++++++++++++++++++++++++++++++++++---
   trunk/boost/fusion/container/vector/detail/vector_n.hpp | 2 +-
   trunk/boost/fusion/container/vector/vector.hpp | 7 +++++++
   trunk/boost/fusion/support/pair.hpp | 6 ++++++
   6 files changed, 68 insertions(+), 6 deletions(-)

Modified: trunk/boost/fusion/container/map/detail/cpp03/map.hpp
==============================================================================
--- trunk/boost/fusion/container/map/detail/cpp03/map.hpp (original)
+++ trunk/boost/fusion/container/map/detail/cpp03/map.hpp 2013-02-04 01:21:45 EST (Mon, 04 Feb 2013)
@@ -74,13 +74,18 @@
         #include <boost/fusion/container/map/detail/cpp03/map_forward_ctor.hpp>
 
         template <typename T>
- map&
- operator=(T const& rhs)
+ map& operator=(T const& rhs)
         {
             data = rhs;
             return *this;
         }
 
+ map& operator=(map const& rhs)
+ {
+ data = rhs.data;
+ return *this;
+ }
+
         storage_type& get_data() { return data; }
         storage_type const& get_data() const { return data; }
 

Modified: trunk/boost/fusion/container/map/detail/map_impl.hpp
==============================================================================
--- trunk/boost/fusion/container/map/detail/map_impl.hpp (original)
+++ trunk/boost/fusion/container/map/detail/map_impl.hpp 2013-02-04 01:21:45 EST (Mon, 04 Feb 2013)
@@ -38,6 +38,10 @@
         map_impl(Iterator const& iter, map_impl_from_iterator)
         {}
 
+ template <typename Iterator>
+ void assign(Iterator const& iter, map_impl_from_iterator)
+ {}
+
         void get();
         void get_val();
         void get_key();
@@ -158,6 +162,13 @@
             return *this;
         }
 
+ template <typename Iterator>
+ void assign(Iterator const& iter, map_impl_from_iterator fi)
+ {
+ rest_type::assign(fusion::next(iter), fi);
+ element = *iter;
+ }
+
         Pair element;
     };
 }}}

Modified: trunk/boost/fusion/container/map/map.hpp
==============================================================================
--- trunk/boost/fusion/container/map/map.hpp (original)
+++ trunk/boost/fusion/container/map/map.hpp 2013-02-04 01:21:45 EST (Mon, 04 Feb 2013)
@@ -8,6 +8,7 @@
 #define FUSION_MAP_MAIN_07212005_1106
 
 #include <boost/fusion/container/map/map_fwd.hpp>
+#include <boost/fusion/support/pair.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
 // Without variadics, we will use the PP version
@@ -29,9 +30,12 @@
 #include <boost/fusion/sequence/intrinsic/end.hpp>
 #include <boost/fusion/sequence/intrinsic/at.hpp>
 #include <boost/fusion/sequence/intrinsic/at_c.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
 #include <boost/fusion/support/sequence_base.hpp>
 #include <boost/fusion/support/category_of.hpp>
 
+#include <boost/utility/enable_if.hpp>
+
 namespace boost { namespace fusion
 {
     struct map_tag;
@@ -46,11 +50,40 @@
         typedef mpl::int_<base_type::size> size;
         typedef mpl::false_ is_view;
 
- map() {};
+ map() {}
+
+ template <typename Sequence>
+ map(Sequence const& seq
+ , typename enable_if<traits::is_sequence<Sequence>>::type* /*dummy*/ = 0)
+ : base_type(begin(seq), detail::map_impl_from_iterator())
+ {}
 
- map(typename detail::call_param<T>::type... element)
- : base_type(element...)
+ template <typename First, typename ...T_>
+ map(First const& first, T_ const&... rest)
+ : base_type(first, rest...)
         {}
+
+ template <typename First, typename ...T_>
+ map(First& first, T_&... rest)
+ : base_type(first, rest...)
+ {}
+
+ map& operator=(map const& rhs)
+ {
+ base_type::operator=(rhs.base());
+ return *this;
+ }
+
+ template <typename Sequence>
+ typename enable_if<traits::is_sequence<Sequence>, map&>::type
+ operator=(Sequence const& seq)
+ {
+ base().assign(begin(seq), detail::map_impl_from_iterator());
+ return *this;
+ }
+
+ base_type& base() { return *this; }
+ base_type const& base() const { return *this; }
     };
 }}
 

Modified: trunk/boost/fusion/container/vector/detail/vector_n.hpp
==============================================================================
--- trunk/boost/fusion/container/vector/detail/vector_n.hpp (original)
+++ trunk/boost/fusion/container/vector/detail/vector_n.hpp 2013-02-04 01:21:45 EST (Mon, 04 Feb 2013)
@@ -204,7 +204,7 @@
         BOOST_PP_CAT(vector, N)&
         operator=(BOOST_PP_CAT(vector, N) const& vec)
         {
- base_type::operator=(*this);
+ base_type::operator=(vec);
             return *this;
         }
 

Modified: trunk/boost/fusion/container/vector/vector.hpp
==============================================================================
--- trunk/boost/fusion/container/vector/vector.hpp (original)
+++ trunk/boost/fusion/container/vector/vector.hpp 2013-02-04 01:21:45 EST (Mon, 04 Feb 2013)
@@ -140,6 +140,13 @@
             return *this;
         }
 
+ vector&
+ operator=(vector const& rhs)
+ {
+ vec = rhs.vec;
+ return *this;
+ }
+
 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
         vector&
         operator=(vector&& rhs)

Modified: trunk/boost/fusion/support/pair.hpp
==============================================================================
--- trunk/boost/fusion/support/pair.hpp (original)
+++ trunk/boost/fusion/support/pair.hpp 2013-02-04 01:21:45 EST (Mon, 04 Feb 2013)
@@ -42,6 +42,12 @@
             return *this;
         }
 
+ pair& operator=(pair const& rhs)
+ {
+ second = rhs.second;
+ return *this;
+ }
+
         typedef First first_type;
         typedef Second second_type;
         Second second;


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