is_reference_member.hpp
Go to the documentation of this file.
1 /*
2 
3 @Copyright Barrett Adair 2015-2017
4 
5 Distributed under the Boost Software License, Version 1.0.
6 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
7 
8 */
9 
10 #ifndef BOOST_CLBL_TRTS_IS_REFERENCE_MEMBER_HPP
11 #define BOOST_CLBL_TRTS_IS_REFERENCE_MEMBER_HPP
12 
14 
15 namespace boost { namespace callable_traits {
16 
17 //[ is_reference_member_hpp
18 /*`[section:ref_is_reference_member is_reference_member]
19 [heading Header]
20 ``#include <boost/callable_traits/is_reference_member.hpp>``
21 [heading Definition]
22 */
23 
24 
25 // inherits from either std::true_type or std::false_type
26 template<typename T>
27 struct is_reference_member;
28 
29 //<-
30 template<typename T>
32  detail::shallow_decay<T>>::is_reference_member {
33 
34  using type = typename detail::traits<
36 };
37 
38 #ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
39 
40 template<typename T>
41 struct is_reference_member_v {
42  static_assert(std::is_same<T, detail::dummy>::value,
43  "Variable templates not supported on this compiler.");
44 };
45 
46 #else
47 //->
48 // only available when variable templates are supported
49 template<typename T>
50 //<-
52 //->
53 constexpr bool is_reference_member_v = //see below
54 //<-
55  detail::traits<detail::shallow_decay<T>>::is_reference_member::value;
56 
57 #endif
58 
59 }} // namespace boost::callable_traits
60 //->
61 
62 /*`
63 [heading Constraints]
64 * none
65 
66 [heading Behavior]
67 * `is_reference_member<T>::value` is `true` when either:
68  * `T` is a function type with a '&' or '&&' member qualifier
69  * `T` is a pointer to a member function with a '&' or '&&' member qualifiers
70  * `T` is a function object with a non-overloaded `operator()`, where the `operator()` has a '&' or '&&' member qualifier
71 * On compilers that support variable templates, `is_reference_member_v<T>` is equivalent to `is_reference_member<T>::value`.
72 
73 [heading Input/Output Examples]
74 [table
75  [[`T`] [`is_reference_member_v<T>`]]
76  [[`int() &`] [`true`]]
77  [[`int() const &&`] [`true`]]
78  [[`int(foo::* const)() &&`] [`true`]]
79  [[`int(foo::*)(...) volatile &`] [`true`]]
80  [[`int() const`] [`false`]]
81  [[`int() volatile`] [`false`]]
82  [[`int(foo::*)() const`] [`false`]]
83  [[`int() const`] [`false`]]
84  [[`int() volatile`] [`false`]]
85  [[`int(*)()`] [`false`]]
86  [[`int`] [`false`]]
87  [[`int foo::*`] [`false`]]
88  [[`const int foo::*`] [`false`]]
89 ]
90 
91 [heading Example Program]
92 [import ../example/is_reference_member.cpp]
93 [is_reference_member]
94 [endsect]
95 */
96 //]
97 
98 #endif // #ifndef BOOST_CLBL_TRTS_IS_REFERENCE_MEMBER_HPP
#define BOOST_CLBL_TRAITS_INLINE_VAR
Definition: config.hpp:27
typename std::remove_cv< typename std::remove_reference< T >::type >::type shallow_decay
Definition: utility.hpp:79
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
constexpr BOOST_CLBL_TRAITS_INLINE_VAR bool is_reference_member_v
typename detail::traits< detail::shallow_decay< T > >::is_reference_member type