Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/fusion/container/deque/detail/keyed_element.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*=============================================================================
0002     Copyright (c) 2005-2012 Joel de Guzman
0003     Copyright (c) 2005-2006 Dan Marsden
0004 
0005     Distributed under the Boost Software License, Version 1.0. (See accompanying
0006     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 ==============================================================================*/
0008 #if !defined(BOOST_FUSION_DEQUE_DETAIL_KEYED_ELEMENT_26112006_1330)
0009 #define BOOST_FUSION_DEQUE_DETAIL_KEYED_ELEMENT_26112006_1330
0010 
0011 #include <boost/fusion/support/config.hpp>
0012 #include <boost/fusion/support/detail/access.hpp>
0013 #include <boost/fusion/iterator/deref.hpp>
0014 #include <boost/fusion/iterator/next.hpp>
0015 
0016 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && BOOST_WORKAROUND(BOOST_GCC, / 100 == 404)
0017 #include <boost/core/enable_if.hpp>
0018 #include <boost/type_traits/is_same.hpp>
0019 #endif
0020 
0021 namespace boost { namespace fusion
0022 {
0023     struct fusion_sequence_tag;
0024 }}
0025 
0026 namespace boost { namespace fusion { namespace detail
0027 {
0028     struct nil_keyed_element
0029     {
0030         typedef fusion_sequence_tag tag;
0031         BOOST_FUSION_GPU_ENABLED
0032         void get();
0033 
0034         template<typename It>
0035         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0036         static nil_keyed_element
0037         from_iterator(It const&)
0038         {
0039             return nil_keyed_element();
0040         }
0041     };
0042 
0043     template <typename Key, typename Value, typename Rest>
0044     struct keyed_element : Rest
0045     {
0046         typedef Rest base;
0047         typedef fusion_sequence_tag tag;
0048         using Rest::get;
0049 
0050         template <typename It>
0051         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0052         static keyed_element
0053         from_iterator(It const& it)
0054         {
0055             return keyed_element(
0056                 *it, base::from_iterator(fusion::next(it)));
0057         }
0058 
0059         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0060         keyed_element(keyed_element const& rhs)
0061           : Rest(rhs.get_base()), value_(rhs.value_)
0062         {}
0063 
0064 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
0065         BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0066         keyed_element(keyed_element&& rhs)
0067           : Rest(rhs.forward_base())
0068           , value_(BOOST_FUSION_FWD_ELEM(Value, rhs.value_))
0069         {}
0070 #endif
0071 
0072         template <typename U, typename Rst>
0073         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0074         keyed_element(keyed_element<Key, U, Rst> const& rhs
0075           , typename enable_if<is_convertible<U, Value> >::type* = 0)
0076           : Rest(rhs.get_base()), value_(rhs.value_)
0077         {}
0078 
0079 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
0080 #endif
0081 
0082         BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0083         Rest& get_base() BOOST_NOEXCEPT
0084         {
0085             return *this;
0086         }
0087 
0088         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0089         Rest const& get_base() const BOOST_NOEXCEPT
0090         {
0091             return *this;
0092         }
0093 
0094 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
0095         BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0096         Rest&& forward_base() BOOST_NOEXCEPT
0097         {
0098             return std::move(*static_cast<Rest*>(this));
0099         }
0100 #endif
0101 
0102         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0103         typename cref_result<Value>::type get(Key) const
0104         {
0105             return value_;
0106         }
0107 
0108         BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0109         typename ref_result<Value>::type get(Key)
0110         {
0111             return value_;
0112         }
0113 
0114         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0115         keyed_element(
0116             typename detail::call_param<Value>::type value
0117           , Rest const& rest)
0118             : Rest(rest), value_(value)
0119         {}
0120 
0121 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
0122 #if BOOST_WORKAROUND(BOOST_GCC, / 100 == 404)
0123         template <typename Value_, typename = typename enable_if<is_same<Value_, Value> >::type>
0124 #else
0125         typedef Value Value_;
0126 #endif
0127         BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0128         keyed_element(Value_&& value, Rest&& rest)
0129             : Rest(std::move(rest))
0130             , value_(BOOST_FUSION_FWD_ELEM(Value, value))
0131         {}
0132 #endif
0133 
0134         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0135         keyed_element()
0136             : Rest(), value_()
0137         {}
0138 
0139         template<typename U, typename Rst>
0140         BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0141         keyed_element& operator=(keyed_element<Key, U, Rst> const& rhs)
0142         {
0143             base::operator=(static_cast<Rst const&>(rhs)); // cast for msvc-7.1
0144             value_ = rhs.value_;
0145             return *this;
0146         }
0147 
0148         BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0149         keyed_element& operator=(keyed_element const& rhs)
0150         {
0151             base::operator=(rhs);
0152             value_ = rhs.value_;
0153             return *this;
0154         }
0155 
0156 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
0157         BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0158         keyed_element& operator=(keyed_element&& rhs)
0159         {
0160             base::operator=(rhs.forward_base());
0161             value_ = std::move(rhs.value_);
0162             return *this;
0163         }
0164 #endif
0165 
0166         Value value_;
0167     };
0168 
0169     template<typename Elem, typename Key>
0170     struct keyed_element_value_at
0171       : keyed_element_value_at<typename Elem::base, Key>
0172     {};
0173 
0174     template<typename Key, typename Value, typename Rest>
0175     struct keyed_element_value_at<keyed_element<Key, Value, Rest>, Key>
0176     {
0177         typedef Value type;
0178     };
0179 }}}
0180 
0181 #endif