File indexing completed on 2025-01-30 10:02:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
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 }}}
0062
0063 #endif