File indexing completed on 2025-01-18 09:33:53
0001
0002
0003
0004
0005
0006
0007 #ifndef FUSION_SET_11062014_1726
0008 #define FUSION_SET_11062014_1726
0009
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/fusion/container/set/set_fwd.hpp>
0012
0013
0014
0015
0016 #if !defined(BOOST_FUSION_HAS_VARIADIC_SET)
0017 # include <boost/fusion/container/set/detail/cpp03/set.hpp>
0018 #else
0019
0020
0021
0022
0023 #include <boost/fusion/support/detail/access.hpp>
0024 #include <boost/fusion/support/void.hpp>
0025 #include <boost/fusion/support/detail/enabler.hpp>
0026 #include <boost/fusion/support/sequence_base.hpp>
0027 #include <boost/fusion/support/category_of.hpp>
0028 #include <boost/fusion/support/is_sequence.hpp>
0029 #include <boost/fusion/support/detail/is_same_size.hpp>
0030 #include <boost/fusion/container/vector/vector.hpp>
0031 #include <boost/fusion/container/set/detail/begin_impl.hpp>
0032 #include <boost/fusion/container/set/detail/end_impl.hpp>
0033 #include <boost/fusion/container/set/detail/value_of_impl.hpp>
0034 #include <boost/fusion/container/set/detail/deref_data_impl.hpp>
0035 #include <boost/fusion/container/set/detail/deref_impl.hpp>
0036 #include <boost/fusion/container/set/detail/key_of_impl.hpp>
0037 #include <boost/fusion/container/set/detail/value_of_data_impl.hpp>
0038 #include <boost/mpl/bool.hpp>
0039 #include <boost/core/enable_if.hpp>
0040
0041 namespace boost { namespace fusion
0042 {
0043 struct fusion_sequence_tag;
0044
0045 template <>
0046 struct set<> : sequence_base<set<> >
0047 {
0048 struct category : forward_traversal_tag, associative_tag {};
0049
0050 typedef set_tag fusion_tag;
0051 typedef fusion_sequence_tag tag;
0052 typedef mpl::false_ is_view;
0053
0054 typedef vector<> storage_type;
0055
0056 typedef storage_type::size size;
0057
0058 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0059 set()
0060 : data() {}
0061
0062 template <typename Sequence>
0063 BOOST_FUSION_GPU_ENABLED
0064 set(Sequence const& rhs,
0065 typename enable_if<traits::is_sequence<Sequence>, detail::enabler_>::type = detail::enabler,
0066 typename enable_if<detail::is_same_size<Sequence, storage_type>, detail::enabler_>::type = detail::enabler)
0067 : data(rhs) {}
0068
0069 template <typename T>
0070 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0071 set&
0072 operator=(T const& rhs)
0073 {
0074 data = rhs;
0075 return *this;
0076 }
0077
0078 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0079 storage_type& get_data() { return data; }
0080 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0081 storage_type const& get_data() const { return data; }
0082
0083 private:
0084 storage_type data;
0085 };
0086
0087 template <typename ...T>
0088 struct set : sequence_base<set<T...> >
0089 {
0090 struct category : forward_traversal_tag, associative_tag {};
0091
0092 typedef set_tag fusion_tag;
0093 typedef fusion_sequence_tag tag;
0094 typedef mpl::false_ is_view;
0095
0096 typedef vector<T...> storage_type;
0097
0098 typedef typename storage_type::size size;
0099
0100 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0101 set()
0102 : data() {}
0103
0104 template <typename Sequence>
0105 BOOST_FUSION_GPU_ENABLED
0106 set(Sequence&& rhs,
0107 typename enable_if<traits::is_sequence<Sequence>, detail::enabler_>::type = detail::enabler,
0108 typename enable_if<detail::is_same_size<Sequence, storage_type>, detail::enabler_>::type = detail::enabler)
0109 : data(std::forward<Sequence>(rhs)) {}
0110
0111 template <typename ...U>
0112 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0113 explicit
0114 set(U&& ...args)
0115 : data(std::forward<U>(args)...) {}
0116
0117 template <typename U>
0118 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0119 set&
0120 operator=(U&& rhs)
0121 {
0122 data = std::forward<U>(rhs);
0123 return *this;
0124 }
0125
0126 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0127 storage_type& get_data() { return data; }
0128 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0129 storage_type const& get_data() const { return data; }
0130
0131 private:
0132 storage_type data;
0133 };
0134
0135 }}
0136
0137 #endif
0138 #endif
0139
0140