/*============================================================================= Copyright (c) 2014-2015 Kohei Takahashi 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) ==============================================================================*/ #ifndef FUSION_SET_11062014_1726 #define FUSION_SET_11062014_1726 #include #include /////////////////////////////////////////////////////////////////////////////// // Without variadics, we will use the PP version /////////////////////////////////////////////////////////////////////////////// #if !defined(BOOST_FUSION_HAS_VARIADIC_SET) # include #else /////////////////////////////////////////////////////////////////////////////// // C++11 interface /////////////////////////////////////////////////////////////////////////////// #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace fusion { struct fusion_sequence_tag; template <> struct set<> : sequence_base > { struct category : forward_traversal_tag, associative_tag {}; typedef set_tag fusion_tag; typedef fusion_sequence_tag tag; // this gets picked up by MPL typedef mpl::false_ is_view; typedef vector<> storage_type; typedef storage_type::size size; BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED set() : data() {} template BOOST_FUSION_GPU_ENABLED set(Sequence const& rhs, typename enable_if, detail::enabler_>::type = detail::enabler, typename enable_if, detail::enabler_>::type = detail::enabler) : data(rhs) {} template BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED set& operator=(T const& rhs) { data = rhs; return *this; } BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED storage_type& get_data() { return data; } BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED storage_type const& get_data() const { return data; } private: storage_type data; }; template struct set : sequence_base > { struct category : forward_traversal_tag, associative_tag {}; typedef set_tag fusion_tag; typedef fusion_sequence_tag tag; // this gets picked up by MPL typedef mpl::false_ is_view; typedef vector storage_type; typedef typename storage_type::size size; BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED set() : data() {} template BOOST_FUSION_GPU_ENABLED set(Sequence&& rhs, typename enable_if, detail::enabler_>::type = detail::enabler, typename enable_if, detail::enabler_>::type = detail::enabler) : data(std::forward(rhs)) {} template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED explicit set(U&& ...args) : data(std::forward(args)...) {} template BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED set& operator=(U&& rhs) { data = std::forward(rhs); return *this; } BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED storage_type& get_data() { return data; } BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED storage_type const& get_data() const { return data; } private: storage_type data; }; }} #endif #endif