Boost logo

Boost-Commit :

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


Author: djowel
Date: 2013-02-04 06:52:58 EST (Mon, 04 Feb 2013)
New Revision: 82726
URL: http://svn.boost.org/trac/boost/changeset/82726

Log:
map move supported + value_at_impl added
Added:
   trunk/boost/fusion/container/map/detail/value_at_impl.hpp (contents, props changed)
Text files modified:
   trunk/boost/fusion/container/map/map.hpp | 30 ++++++++++++++++++++++++++++--
   trunk/boost/fusion/support/pair.hpp | 25 +++++++++++++++++++++++++
   2 files changed, 53 insertions(+), 2 deletions(-)

Added: trunk/boost/fusion/container/map/detail/value_at_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/container/map/detail/value_at_impl.hpp 2013-02-04 06:52:58 EST (Mon, 04 Feb 2013)
@@ -0,0 +1,37 @@
+/*=============================================================================
+ Copyright (c) 2001-2013 Joel de Guzman
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#if !defined(BOOST_FUSION_MAP_DETAIL_VALUE_AT_IMPL_02042013_0821)
+#define BOOST_FUSION_MAP_DETAIL_VALUE_AT_IMPL_02042013_0821
+
+#include <boost/mpl/at.hpp>
+
+namespace boost { namespace fusion
+{
+ struct map_tag;
+
+ namespace extension
+ {
+ template <typename Tag>
+ struct value_at_impl;
+
+ template <>
+ struct value_at_impl<map_tag>
+ {
+ template <typename Sequence, typename N>
+ struct apply
+ {
+ typedef mpl::int_<N::value> index;
+ typedef
+ decltype(std::declval<Sequence>().get_val(index()))
+ type;
+ };
+ };
+ }
+}}
+
+#endif
+

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 06:52:58 EST (Mon, 04 Feb 2013)
@@ -25,6 +25,7 @@
 #include <boost/fusion/container/map/detail/end_impl.hpp>
 #include <boost/fusion/container/map/detail/at_impl.hpp>
 #include <boost/fusion/container/map/detail/at_key_impl.hpp>
+#include <boost/fusion/container/map/detail/value_at_impl.hpp>
 #include <boost/fusion/container/map/detail/value_at_key_impl.hpp>
 #include <boost/fusion/sequence/intrinsic/begin.hpp>
 #include <boost/fusion/sequence/intrinsic/end.hpp>
@@ -52,6 +53,14 @@
 
         map() {}
 
+ map(map const& seq)
+ : base_type(seq.base())
+ {}
+
+ map(map&& seq)
+ : base_type(std::forward<map>(seq))
+ {}
+
         template <typename Sequence>
         map(Sequence const& seq
           , typename enable_if<traits::is_sequence<Sequence>>::type* /*dummy*/ = 0)
@@ -64,22 +73,39 @@
           : base_type(begin(seq), detail::map_impl_from_iterator())
         {}
 
+ template <typename Sequence>
+ map(Sequence&& seq
+ , typename enable_if<traits::is_sequence<Sequence>>::type* /*dummy*/ = 0)
+ : base_type(begin(seq), detail::map_impl_from_iterator())
+ {}
+
         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(First&& first, T_&&... rest)
+ : base_type(std::forward<First>(first), std::forward<T_>(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;
         }
 
+ map& operator=(map&& rhs)
+ {
+ base_type::operator=(std::forward<base_type>(rhs.base()));
+ return *this;
+ }
+
         template <typename Sequence>
         typename enable_if<traits::is_sequence<Sequence>, map&>::type
         operator=(Sequence const& seq)

Modified: trunk/boost/fusion/support/pair.hpp
==============================================================================
--- trunk/boost/fusion/support/pair.hpp (original)
+++ trunk/boost/fusion/support/pair.hpp 2013-02-04 06:52:58 EST (Mon, 04 Feb 2013)
@@ -28,9 +28,26 @@
         pair()
             : second() {}
 
+ pair(pair const& rhs)
+ : second(rhs.second) {}
+
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+ pair(pair&& rhs)
+ : second(std::forward<Second>(rhs.second)) {}
+#endif
+
         pair(typename detail::call_param<Second>::type val)
             : second(val) {}
 
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+
+ template <typename Second2>
+ pair(Second2&& val
+ , typename boost::enable_if<is_convertible<Second2, Second> >::type* /*dummy*/ = 0
+ ) : second(std::forward<Second2>(val)) {}
+
+#endif
+
         template <typename Second2>
         pair(pair<First, Second2> const& rhs)
             : second(rhs.second) {}
@@ -48,6 +65,14 @@
             return *this;
         }
 
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+ pair& operator=(pair&& rhs)
+ {
+ second = std::forward<Second>(rhs.second);
+ return *this;
+ }
+#endif
+
         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