forked from boostorg/fusion
map move supported + value_at_impl added
[SVN r82726]
This commit is contained in:
37
include/boost/fusion/container/map/detail/value_at_impl.hpp
Normal file
37
include/boost/fusion/container/map/detail/value_at_impl.hpp
Normal file
@ -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
|
||||
|
@ -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 @@ namespace boost { namespace fusion
|
||||
|
||||
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 @@ namespace boost { namespace fusion
|
||||
: 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)
|
||||
|
@ -28,9 +28,26 @@ namespace boost { namespace fusion
|
||||
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 @@ namespace boost { namespace fusion
|
||||
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;
|
||||
|
Reference in New Issue
Block a user