File indexing completed on 2025-01-18 09:40:55
0001 #ifndef BOOST_MP11_DETAIL_MP_MAP_FIND_HPP_INCLUDED
0002 #define BOOST_MP11_DETAIL_MP_MAP_FIND_HPP_INCLUDED
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <boost/mp11/utility.hpp>
0012 #include <boost/mp11/detail/config.hpp>
0013
0014 #if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1930 )
0015
0016
0017 namespace std
0018 {
0019 template<class... _Types> class tuple;
0020 }
0021
0022 #endif
0023
0024 namespace boost
0025 {
0026 namespace mp11
0027 {
0028
0029
0030 namespace detail
0031 {
0032
0033 #if !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1930 )
0034
0035 template<class T> using mpmf_wrap = mp_identity<T>;
0036 template<class T> using mpmf_unwrap = typename T::type;
0037
0038 #else
0039
0040 template<class... T> struct mpmf_tuple {};
0041
0042 template<class T> struct mpmf_wrap_impl
0043 {
0044 using type = mp_identity<T>;
0045 };
0046
0047 template<class... T> struct mpmf_wrap_impl< std::tuple<T...> >
0048 {
0049 using type = mp_identity< mpmf_tuple<T...> >;
0050 };
0051
0052 template<class T> using mpmf_wrap = typename mpmf_wrap_impl<T>::type;
0053
0054 template<class T> struct mpmf_unwrap_impl
0055 {
0056 using type = typename T::type;
0057 };
0058
0059 template<class... T> struct mpmf_unwrap_impl< mp_identity< mpmf_tuple<T...> > >
0060 {
0061 using type = std::tuple<T...>;
0062 };
0063
0064 template<class T> using mpmf_unwrap = typename mpmf_unwrap_impl<T>::type;
0065
0066 #endif
0067
0068 template<class M, class K> struct mp_map_find_impl;
0069
0070 template<template<class...> class M, class... T, class K> struct mp_map_find_impl<M<T...>, K>
0071 {
0072 using U = mp_inherit<mpmf_wrap<T>...>;
0073
0074 template<template<class...> class L, class... U> static mp_identity<L<K, U...>> f( mp_identity<L<K, U...>>* );
0075 static mp_identity<void> f( ... );
0076
0077 using type = mpmf_unwrap< decltype( f( static_cast<U*>(0) ) ) >;
0078 };
0079
0080 }
0081
0082 template<class M, class K> using mp_map_find = typename detail::mp_map_find_impl<M, K>::type;
0083
0084 }
0085 }
0086
0087 #endif