Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:34:24

0001 /*
0002 
0003 @Copyright Barrett Adair 2015-2017
0004 Distributed under the Boost Software License, Version 1.0.
0005 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
0006 
0007 */
0008 
0009 #ifndef BOOST_CLBL_TRTS_class_of_HPP
0010 #define BOOST_CLBL_TRTS_class_of_HPP
0011 
0012 #include <boost/callable_traits/detail/core.hpp>
0013 
0014 namespace boost { namespace callable_traits {
0015 
0016 //[ class_of_hpp
0017 /*`
0018 [section:ref_class_of class_of]
0019 [heading Header]
0020 ``#include <boost/callable_traits/class_of.hpp>``
0021 [heading Definition]
0022 */
0023 
0024 template<typename T>
0025 using class_of_t = //see below
0026 //<-
0027     detail::try_but_fail_if_invalid<
0028         typename detail::traits<detail::shallow_decay<T>>::class_type,
0029         type_is_not_a_member_pointer>;
0030 
0031 namespace detail {
0032 
0033     template<typename T, typename = std::false_type>
0034     struct class_of_impl {};
0035 
0036     template<typename T>
0037     struct class_of_impl <T, typename std::is_same<
0038         class_of_t<T>, detail::dummy>::type>
0039     {
0040         using type = class_of_t<T>;
0041     };
0042 }
0043 
0044 //->
0045 
0046 template<typename T>
0047 struct class_of : detail::class_of_impl<T> {};
0048 
0049 //<-
0050 }} // namespace boost::callable_traits
0051 //->
0052 
0053 /*`
0054 [heading Constraints]
0055 * `T` must be a member pointer
0056 
0057 [heading Behavior]
0058 * A substitution failure occurs if the constraints are violated.
0059 * The aliased type is the parent class of the member. In other words, if `T` is expanded to `U C::*`, the aliased type is `C`.
0060 
0061 [heading Input/Output Examples]
0062 [table
0063     [[`T`]                              [`class_of_t<T>`]]
0064     [[`int foo::*`]                     [`foo`]]
0065     [[`void(foo::* const &)() const`]           [`foo`]]
0066 ]
0067 
0068 [heading Example Program]
0069 [import ../example/class_of.cpp]
0070 [class_of]
0071 [endsect]
0072 */
0073 //]
0074 
0075 #endif // #ifndef BOOST_CLBL_TRTS_class_of_HPP