]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/fusion/include/boost/fusion/container/set/set.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / fusion / include / boost / fusion / container / set / set.hpp
CommitLineData
7c673cae
FG
1/*=============================================================================
2 Copyright (c) 2014-2015 Kohei Takahashi
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#ifndef FUSION_SET_11062014_1726
8#define FUSION_SET_11062014_1726
9
10#include <boost/fusion/support/config.hpp>
11#include <boost/fusion/container/set/set_fwd.hpp>
12
13///////////////////////////////////////////////////////////////////////////////
14// Without variadics, we will use the PP version
15///////////////////////////////////////////////////////////////////////////////
16#if !defined(BOOST_FUSION_HAS_VARIADIC_SET)
17# include <boost/fusion/container/set/detail/cpp03/set.hpp>
18#else
19
20///////////////////////////////////////////////////////////////////////////////
21// C++11 interface
22///////////////////////////////////////////////////////////////////////////////
23#include <boost/fusion/support/detail/access.hpp>
24#include <boost/fusion/support/void.hpp>
25#include <boost/fusion/support/detail/enabler.hpp>
26#include <boost/fusion/support/sequence_base.hpp>
27#include <boost/fusion/support/category_of.hpp>
28#include <boost/fusion/support/is_sequence.hpp>
29#include <boost/fusion/support/detail/is_same_size.hpp>
30#include <boost/fusion/container/vector/vector.hpp>
31#include <boost/fusion/container/set/detail/begin_impl.hpp>
32#include <boost/fusion/container/set/detail/end_impl.hpp>
33#include <boost/fusion/container/set/detail/value_of_impl.hpp>
34#include <boost/fusion/container/set/detail/deref_data_impl.hpp>
35#include <boost/fusion/container/set/detail/deref_impl.hpp>
36#include <boost/fusion/container/set/detail/key_of_impl.hpp>
37#include <boost/fusion/container/set/detail/value_of_data_impl.hpp>
38#include <boost/mpl/bool.hpp>
39#include <boost/core/enable_if.hpp>
40
41namespace boost { namespace fusion
42{
43 struct fusion_sequence_tag;
44
45 template <>
46 struct set<> : sequence_base<set<> >
47 {
48 struct category : forward_traversal_tag, associative_tag {};
49
50 typedef set_tag fusion_tag;
51 typedef fusion_sequence_tag tag; // this gets picked up by MPL
52 typedef mpl::false_ is_view;
53
54 typedef vector<> storage_type;
55
56 typedef storage_type::size size;
57
58 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
59 set()
60 : data() {}
61
62 template <typename Sequence>
63 BOOST_FUSION_GPU_ENABLED
64 set(Sequence const& rhs,
65 typename enable_if<traits::is_sequence<Sequence>, detail::enabler_>::type = detail::enabler,
66 typename enable_if<detail::is_same_size<Sequence, storage_type>, detail::enabler_>::type = detail::enabler)
67 : data(rhs) {}
68
69 template <typename T>
70 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
71 set&
72 operator=(T const& rhs)
73 {
74 data = rhs;
75 return *this;
76 }
77
78 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
79 storage_type& get_data() { return data; }
80 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
81 storage_type const& get_data() const { return data; }
82
83 private:
84 storage_type data;
85 };
86
87 template <typename ...T>
88 struct set : sequence_base<set<T...> >
89 {
90 struct category : forward_traversal_tag, associative_tag {};
91
92 typedef set_tag fusion_tag;
93 typedef fusion_sequence_tag tag; // this gets picked up by MPL
94 typedef mpl::false_ is_view;
95
96 typedef vector<T...> storage_type;
97
98 typedef typename storage_type::size size;
99
100 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
101 set()
102 : data() {}
103
104 template <typename Sequence>
105 BOOST_FUSION_GPU_ENABLED
106 set(Sequence&& rhs,
107 typename enable_if<traits::is_sequence<Sequence>, detail::enabler_>::type = detail::enabler,
108 typename enable_if<detail::is_same_size<Sequence, storage_type>, detail::enabler_>::type = detail::enabler)
109 : data(std::forward<Sequence>(rhs)) {}
110
111 template <typename ...U>
112 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
113 explicit
114 set(U&& ...args)
115 : data(std::forward<U>(args)...) {}
116
117 template <typename U>
118 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
119 set&
120 operator=(U&& rhs)
121 {
122 data = std::forward<U>(rhs);
123 return *this;
124 }
125
126 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
127 storage_type& get_data() { return data; }
128 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
129 storage_type const& get_data() const { return data; }
130
131 private:
132 storage_type data;
133 };
134
135}}
136
137#endif
138#endif
139
140