File indexing completed on 2025-01-18 09:30:40
0001 #ifndef BOOST_DESCRIBE_DESCRIPTOR_BY_NAME_HPP_INCLUDED
0002 #define BOOST_DESCRIBE_DESCRIPTOR_BY_NAME_HPP_INCLUDED
0003
0004
0005
0006
0007
0008 #include <boost/describe/detail/cx_streq.hpp>
0009 #include <boost/describe/detail/config.hpp>
0010
0011 #if defined(BOOST_DESCRIBE_CXX14)
0012
0013 #include <boost/mp11/algorithm.hpp>
0014 #include <boost/mp11/bind.hpp>
0015 #include <boost/mp11/integral.hpp>
0016
0017 namespace boost
0018 {
0019 namespace describe
0020 {
0021
0022 namespace detail
0023 {
0024
0025 template<class D, class N> using match_by_name = mp11::mp_bool<cx_streq(N::name(), D::name)>;
0026
0027 #define BOOST_DESCRIBE_MAKE_NAME_IMPL2(s, k) struct _boost_name_##s##_##k { static constexpr char const * name() { return #s; } }
0028 #define BOOST_DESCRIBE_MAKE_NAME_IMPL(s, k) BOOST_DESCRIBE_MAKE_NAME_IMPL2(s, k)
0029
0030 }
0031
0032 #define BOOST_DESCRIBE_MAKE_NAME(s) BOOST_DESCRIBE_MAKE_NAME_IMPL(s, __LINE__)
0033
0034 template<class L, class N> using descriptor_by_name = mp11::mp_at<L, mp11::mp_find_if_q<L, mp11::mp_bind_back<detail::match_by_name, N>>>;
0035
0036 }
0037 }
0038
0039 #endif
0040
0041 #endif