]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/fusion/include/boost/fusion/container/map/map.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / fusion / include / boost / fusion / container / map / map.hpp
1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
3
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7 #if !defined(FUSION_MAP_MAIN_07212005_1106)
8 #define FUSION_MAP_MAIN_07212005_1106
9
10 #include <boost/fusion/support/config.hpp>
11 #include <boost/fusion/container/map/map_fwd.hpp>
12 #include <boost/fusion/support/pair.hpp>
13
14 ///////////////////////////////////////////////////////////////////////////////
15 // Without variadics, we will use the PP version
16 ///////////////////////////////////////////////////////////////////////////////
17 #if !defined(BOOST_FUSION_HAS_VARIADIC_MAP)
18 # include <boost/fusion/container/map/detail/cpp03/map.hpp>
19 #else
20
21 ///////////////////////////////////////////////////////////////////////////////
22 // C++11 interface
23 ///////////////////////////////////////////////////////////////////////////////
24 #include <boost/fusion/container/map/detail/map_impl.hpp>
25 #include <boost/fusion/container/map/detail/begin_impl.hpp>
26 #include <boost/fusion/container/map/detail/end_impl.hpp>
27 #include <boost/fusion/container/map/detail/at_impl.hpp>
28 #include <boost/fusion/container/map/detail/at_key_impl.hpp>
29 #include <boost/fusion/container/map/detail/value_at_impl.hpp>
30 #include <boost/fusion/container/map/detail/value_at_key_impl.hpp>
31 #include <boost/fusion/sequence/intrinsic/begin.hpp>
32 #include <boost/fusion/sequence/intrinsic/end.hpp>
33 #include <boost/fusion/sequence/intrinsic/at.hpp>
34 #include <boost/fusion/sequence/intrinsic/at_c.hpp>
35 #include <boost/fusion/support/is_sequence.hpp>
36 #include <boost/fusion/support/sequence_base.hpp>
37 #include <boost/fusion/support/category_of.hpp>
38 #include <boost/fusion/support/void.hpp>
39 #include <boost/fusion/support/detail/enabler.hpp>
40
41 #include <boost/utility/enable_if.hpp>
42
43 namespace boost { namespace fusion
44 {
45 struct map_tag;
46
47 template <typename ...T>
48 struct map : detail::map_impl<0, T...>, sequence_base<map<T...>>
49 {
50 typedef map_tag fusion_tag;
51 typedef detail::map_impl<0, T...> base_type;
52
53 struct category : random_access_traversal_tag, associative_tag {};
54 typedef mpl::int_<base_type::size> size;
55 typedef mpl::false_ is_view;
56
57 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
58 map() {}
59
60 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
61 map(map const& seq)
62 : base_type(seq.base())
63 {}
64
65 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
66 map(map&& seq)
67 : base_type(std::forward<map>(seq))
68 {}
69
70 template <typename Sequence>
71 BOOST_FUSION_GPU_ENABLED
72 map(Sequence const& seq
73 , typename enable_if<traits::is_sequence<Sequence>, detail::enabler_>::type = detail::enabler)
74 : base_type(begin(seq), detail::map_impl_from_iterator())
75 {}
76
77 template <typename Sequence>
78 BOOST_FUSION_GPU_ENABLED
79 map(Sequence& seq
80 , typename enable_if<traits::is_sequence<Sequence>, detail::enabler_>::type = detail::enabler)
81 : base_type(begin(seq), detail::map_impl_from_iterator())
82 {}
83
84 template <typename Sequence>
85 BOOST_FUSION_GPU_ENABLED
86 map(Sequence&& seq
87 , typename enable_if<traits::is_sequence<Sequence>, detail::enabler_>::type = detail::enabler)
88 : base_type(begin(seq), detail::map_impl_from_iterator())
89 {}
90
91 template <typename First, typename ...T_>
92 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
93 map(First const& first, T_ const&... rest)
94 : base_type(first, rest...)
95 {}
96
97 template <typename First, typename ...T_>
98 BOOST_FUSION_GPU_ENABLED
99 map(First&& first, T_&&... rest)
100 : base_type(BOOST_FUSION_FWD_ELEM(First, first), BOOST_FUSION_FWD_ELEM(T_, rest)...)
101 {}
102
103 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
104 map& operator=(map const& rhs)
105 {
106 base_type::operator=(rhs.base());
107 return *this;
108 }
109
110 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
111 map& operator=(map&& rhs)
112 {
113 base_type::operator=(std::forward<base_type>(rhs.base()));
114 return *this;
115 }
116
117 template <typename Sequence>
118 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
119 typename enable_if<traits::is_sequence<Sequence>, map&>::type
120 operator=(Sequence const& seq)
121 {
122 base().assign(begin(seq), detail::map_impl_from_iterator());
123 return *this;
124 }
125
126 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
127 base_type& base() BOOST_NOEXCEPT { return *this; }
128 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
129 base_type const& base() const BOOST_NOEXCEPT { return *this; }
130 };
131 }}
132
133 #endif
134 #endif