class_of.hpp
Go to the documentation of this file.
1 /*
2 
3 @Copyright Barrett Adair 2015-2017
4 Distributed under the Boost Software License, Version 1.0.
5 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
6 
7 */
8 
9 #ifndef BOOST_CLBL_TRTS_class_of_HPP
10 #define BOOST_CLBL_TRTS_class_of_HPP
11 
13 
14 namespace boost { namespace callable_traits {
15 
16 //[ class_of_hpp
17 /*`
18 [section:ref_class_of class_of]
19 [heading Header]
20 ``#include <boost/callable_traits/class_of.hpp>``
21 [heading Definition]
22 */
23 
24 template<typename T>
25 using class_of_t = //see below
26 //<-
28  typename detail::traits<detail::shallow_decay<T>>::class_type,
29  type_is_not_a_member_pointer>;
30 
31 namespace detail {
32 
33  template<typename T, typename = std::false_type>
34  struct class_of_impl {};
35 
36  template<typename T>
37  struct class_of_impl <T, typename std::is_same<
38  class_of_t<T>, detail::dummy>::type>
39  {
41  };
42 }
43 
44 //->
45 
46 template<typename T>
48 
49 //<-
50 }} // namespace boost::callable_traits
51 //->
52 
53 /*`
54 [heading Constraints]
55 * `T` must be a member pointer
56 
57 [heading Behavior]
58 * A substitution failure occurs if the constraints are violated.
59 * 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`.
60 
61 [heading Input/Output Examples]
62 [table
63  [[`T`] [`class_of_t<T>`]]
64  [[`int foo::*`] [`foo`]]
65  [[`void(foo::* const &)() const`] [`foo`]]
66 ]
67 
68 [heading Example Program]
69 [import ../example/class_of.cpp]
70 [class_of]
71 [endsect]
72 */
73 //]
74 
75 #endif // #ifndef BOOST_CLBL_TRTS_class_of_HPP
sfinae_try< T, fail_when_same< U, invalid_type, ErrorType >, fail_when_same< U, reference_error, reference_type_not_supported_by_this_metafunction > > try_but_fail_if_invalid
Definition: utility.hpp:58
typename BOOST_CLBL_TRTS_DISJUNCTION(function_object< unwrap_reference< T > >, function< T >, pmf< T >, pmd< T >, default_callable_traits< T >)::traits traits
Definition: traits.hpp:25
detail::try_but_fail_if_invalid< typename detail::traits< detail::shallow_decay< T > >::class_type, type_is_not_a_member_pointer > class_of_t
Definition: class_of.hpp:29