Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:02:09

0001 //-----------------------------------------------------------------------------
0002 // boost variant/detail/element_index.hpp header file
0003 // See http://www.boost.org for updates, documentation, and revision history.
0004 //-----------------------------------------------------------------------------
0005 //
0006 // Copyright (c) 2014-2023 Antony Polukhin
0007 //
0008 // Distributed under the Boost Software License, Version 1.0. (See
0009 // accompanying file LICENSE_1_0.txt or copy at
0010 // http://www.boost.org/LICENSE_1_0.txt)
0011 
0012 #ifndef BOOST_VARIANT_DETAIL_ELEMENT_INDEX_HPP
0013 #define BOOST_VARIANT_DETAIL_ELEMENT_INDEX_HPP
0014 
0015 #include <boost/config.hpp>
0016 #include <boost/variant/recursive_wrapper_fwd.hpp>
0017 #include <boost/variant/variant_fwd.hpp>
0018 
0019 #include <boost/type_traits/remove_cv.hpp>
0020 #include <boost/type_traits/remove_reference.hpp>
0021 #include <boost/mpl/find_if.hpp>
0022 
0023 namespace boost { namespace detail { namespace variant {
0024 
0025 template <class VariantElement, class T>
0026 struct variant_element_functor :
0027     boost::mpl::or_<
0028         boost::is_same<VariantElement, T>,
0029         boost::is_same<VariantElement, boost::recursive_wrapper<T> >,
0030         boost::is_same<VariantElement, T& >
0031     >
0032 {};
0033 
0034 template <class Types, class T>
0035 struct element_iterator_impl :
0036     boost::mpl::find_if<
0037         Types,
0038         boost::mpl::or_<
0039             variant_element_functor<boost::mpl::_1, T>,
0040             variant_element_functor<boost::mpl::_1, typename boost::remove_cv<T>::type >
0041         >
0042     >
0043 {};
0044 
0045 template <class Variant, class T>
0046 struct element_iterator :
0047     element_iterator_impl< typename Variant::types, typename boost::remove_reference<T>::type >
0048 {};
0049 
0050 template <class Variant, class T>
0051 struct holds_element :
0052     boost::mpl::not_<
0053         boost::is_same<
0054             typename boost::mpl::end<typename Variant::types>::type,
0055             typename element_iterator<Variant, T>::type
0056         >
0057     >
0058 {};
0059 
0060 
0061 }}} // namespace boost::detail::variant
0062 
0063 #endif // BOOST_VARIANT_DETAIL_ELEMENT_INDEX_HPP