/*============================================================================= Copyright (c) 2005-2013 Joel de Guzman 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) ==============================================================================*/ #if !defined(BOOST_FUSION_MAP_IMPL_02032013_2233) #define BOOST_FUSION_MAP_IMPL_02032013_2233 #include #include #include #include #include #include namespace boost { namespace fusion { struct fusion_sequence_tag; }} namespace boost { namespace fusion { namespace detail { struct map_impl_from_iterator {}; template struct map_impl; template struct map_impl { typedef fusion_sequence_tag tag; static int const index = index_; static int const size = 0; BOOST_FUSION_GPU_ENABLED map_impl() {} template BOOST_FUSION_GPU_ENABLED map_impl(Iterator const& iter, map_impl_from_iterator) {} template BOOST_FUSION_GPU_ENABLED void assign(Iterator const& iter, map_impl_from_iterator) {} BOOST_FUSION_GPU_ENABLED void get(); BOOST_FUSION_GPU_ENABLED void get_val(); BOOST_FUSION_GPU_ENABLED void get_key(); }; template struct map_impl : map_impl { typedef fusion_sequence_tag tag; typedef map_impl rest_type; using rest_type::get; using rest_type::get_val; using rest_type::get_key; static int const index = index_; static int const size = rest_type::size + 1; typedef Pair pair_type; typedef typename Pair::first_type key_type; typedef typename Pair::second_type value_type; BOOST_FUSION_GPU_ENABLED map_impl() : rest_type(), element() {} BOOST_FUSION_GPU_ENABLED map_impl(map_impl const& rhs) : rest_type(rhs.get_base()), element(rhs.element) {} BOOST_FUSION_GPU_ENABLED map_impl(map_impl&& rhs) : rest_type(std::forward(*static_cast(&rhs))) , element(std::forward(rhs.element)) {} template BOOST_FUSION_GPU_ENABLED map_impl(map_impl const& rhs) : rest_type(rhs.get_base()), element(rhs.element) {} BOOST_FUSION_GPU_ENABLED map_impl(typename detail::call_param::type element_ , typename detail::call_param::type... rest) : rest_type(rest...), element(element_) {} BOOST_FUSION_GPU_ENABLED map_impl(Pair&& element_, T&&... rest) : rest_type(std::forward(rest)...) , element(std::forward(element_)) {} template BOOST_FUSION_GPU_ENABLED map_impl(Iterator const& iter, map_impl_from_iterator fi) : rest_type(fusion::next(iter), fi) , element(*iter) {} BOOST_FUSION_GPU_ENABLED rest_type& get_base() { return *this; } BOOST_FUSION_GPU_ENABLED rest_type const& get_base() const { return *this; } BOOST_FUSION_GPU_ENABLED value_type get_val(mpl::identity); BOOST_FUSION_GPU_ENABLED pair_type get_val(mpl::int_); BOOST_FUSION_GPU_ENABLED value_type get_val(mpl::identity) const; BOOST_FUSION_GPU_ENABLED pair_type get_val(mpl::int_) const; BOOST_FUSION_GPU_ENABLED mpl::identity get_key(mpl::int_); BOOST_FUSION_GPU_ENABLED mpl::identity get_key(mpl::int_) const; BOOST_FUSION_GPU_ENABLED typename cref_result::type get(mpl::identity) const { return element.second; } BOOST_FUSION_GPU_ENABLED typename ref_result::type get(mpl::identity) { return element.second; } BOOST_FUSION_GPU_ENABLED typename cref_result::type get(mpl::int_) const { return element; } BOOST_FUSION_GPU_ENABLED typename ref_result::type get(mpl::int_) { return element; } template BOOST_FUSION_GPU_ENABLED map_impl& operator=(map_impl const& rhs) { rest_type::operator=(rhs); element = rhs.element; return *this; } BOOST_FUSION_GPU_ENABLED map_impl& operator=(map_impl const& rhs) { rest_type::operator=(rhs); element = rhs.element; return *this; } BOOST_FUSION_GPU_ENABLED map_impl& operator=(map_impl&& rhs) { rest_type::operator=(std::forward(rhs)); element = std::forward(rhs.element); return *this; } template BOOST_FUSION_GPU_ENABLED void assign(Iterator const& iter, map_impl_from_iterator fi) { rest_type::assign(fusion::next(iter), fi); element = *iter; } Pair element; }; }}} #endif