mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-23 09:07:26 +02:00
More map tests and more API features implemented + tweaks to affected components
[SVN r82713]
This commit is contained in:
@ -74,13 +74,18 @@ namespace boost { namespace fusion
|
||||
#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; }
|
||||
|
||||
|
@ -38,6 +38,10 @@ namespace boost { namespace fusion { namespace detail
|
||||
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 @@ namespace boost { namespace fusion { namespace detail
|
||||
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;
|
||||
};
|
||||
}}}
|
||||
|
@ -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 @@ namespace boost { namespace fusion
|
||||
typedef mpl::int_<base_type::size> size;
|
||||
typedef mpl::false_ is_view;
|
||||
|
||||
map() {};
|
||||
map() {}
|
||||
|
||||
map(typename detail::call_param<T>::type... element)
|
||||
: base_type(element...)
|
||||
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())
|
||||
{}
|
||||
|
||||
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; }
|
||||
};
|
||||
}}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -140,6 +140,13 @@ namespace boost { namespace fusion
|
||||
return *this;
|
||||
}
|
||||
|
||||
vector&
|
||||
operator=(vector const& rhs)
|
||||
{
|
||||
vec = rhs.vec;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
vector&
|
||||
operator=(vector&& rhs)
|
||||
|
@ -42,6 +42,12 @@ namespace boost { namespace fusion
|
||||
return *this;
|
||||
}
|
||||
|
||||
pair& operator=(pair const& rhs)
|
||||
{
|
||||
second = rhs.second;
|
||||
return *this;
|
||||
}
|
||||
|
||||
typedef First first_type;
|
||||
typedef Second second_type;
|
||||
Second second;
|
||||
|
Reference in New Issue
Block a user