Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:35:26

0001 #ifndef BOOST_DESCRIBE_DESCRIPTOR_BY_POINTER_HPP_INCLUDED
0002 #define BOOST_DESCRIBE_DESCRIPTOR_BY_POINTER_HPP_INCLUDED
0003 
0004 // Copyright 2021 Peter Dimov
0005 // Distributed under the Boost Software License, Version 1.0.
0006 // https://www.boost.org/LICENSE_1_0.txt
0007 
0008 #include <boost/describe/detail/config.hpp>
0009 
0010 #if defined(__cpp_nontype_template_parameter_auto) && __cpp_nontype_template_parameter_auto >= 201606L
0011 
0012 #include <boost/mp11/algorithm.hpp>
0013 #include <boost/mp11/bind.hpp>
0014 #include <boost/mp11/integral.hpp>
0015 
0016 namespace boost
0017 {
0018 namespace describe
0019 {
0020 
0021 namespace detail
0022 {
0023 
0024 template<class Pm> constexpr bool cx_pmeq( Pm p1, Pm p2 )
0025 {
0026     return p1 == p2;
0027 }
0028 
0029 template<class Pm1, class Pm2> constexpr bool cx_pmeq( Pm1, Pm2 )
0030 {
0031     return false;
0032 }
0033 
0034 template<auto Pm> struct match_by_pointer
0035 {
0036     template<class D> using fn = mp11::mp_bool< cx_pmeq( D::pointer, Pm ) >;
0037 };
0038 
0039 } // namespace detail
0040 
0041 template<class L, auto Pm> using descriptor_by_pointer = mp11::mp_at<L, mp11::mp_find_if_q<L, detail::match_by_pointer<Pm>>>;
0042 
0043 } // namespace describe
0044 } // namespace boost
0045 
0046 #endif // __cpp_nontype_template_parameter_auto
0047 
0048 #endif // #ifndef BOOST_DESCRIBE_DESCRIPTOR_BY_POINTER_HPP_INCLUDED