is_lvalue_reference_member.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_IS_LVALUE_REFERENCE_MEMBER_HPP
10 #define BOOST_CLBL_TRTS_IS_LVALUE_REFERENCE_MEMBER_HPP
11 
13 
14 namespace boost { namespace callable_traits {
15 
16 //[ is_lvalue_reference_member_hpp
17 /*`[section:ref_is_lvalue_reference_member is_lvalue_reference_member]
18 [heading Header]
19 ``#include <boost/callable_traits/is_lvalue_reference_member.hpp>``
20 [heading Definition]
21 */
22 
23 
24 // inherits from either std::true_type or std::false_type
25 template<typename T>
26 struct is_lvalue_reference_member;
27 
28 //<-
29 template<typename T>
31  : detail::traits<detail::shallow_decay<T>>::is_lvalue_reference_member {
32  using type = typename detail::traits<
34 };
35 
36 #ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
37 
38 template<typename T>
40  static_assert(std::is_same<T, detail::dummy>::value,
41  "Variable templates not supported on this compiler.");
42 };
43 
44 #else
45 //->
46 // only available when variable templates are supported
47 template<typename T>
48 //<-
50 //->
51 constexpr bool is_lvalue_reference_member_v = //see below
52 //<-
53  detail::traits<detail::shallow_decay<T>>::is_lvalue_reference_member::value;
54 
55 #endif
56 
57 }} // namespace boost::callable_traits
58 //->
59 
60 /*`
61 [heading Constraints]
62 * none
63 
64 [heading Behavior]
65 * `is_lvalue_reference_member<T>::value` is `true` when either:
66  * `T` is a function type with a '&' member qualifier
67  * `T` is a pointer to a member function with a '&' member qualifiers
68  * `T` is a function object with a non-overloaded `operator()`, where the `operator()` has a '&' member qualifier
69 * On compilers that support variable templates, `is_lvalue_reference_member_v<T>` is equivalent to `is_lvalue_reference_member<T>::value`.
70 
71 [heading Input/Output Examples]
72 [table
73  [[`T`] [`is_lvalue_reference_member_v<T>`]]
74  [[`int() &`] [`true`]]
75  [[`int(foo::* const)() const &`] [`true`]]
76  [[`int() const`] [`false`]]
77  [[`int() volatile`] [`false`]]
78  [[`int(foo::*)() const`] [`false`]]
79  [[`int() const`] [`false`]]
80  [[`int() volatile`] [`false`]]
81  [[`int() &&`] [`false`]]
82  [[`int(*)()`] [`false`]]
83  [[`int`] [`false`]]
84  [[`int foo::*`] [`false`]]
85  [[`const int foo::*`] [`false`]]
86 ]
87 
88 [heading Example Program]
89 [import ../example/is_lvalue_reference_member.cpp]
90 [is_lvalue_reference_member]
91 [endsect]
92 */
93 //]
94 
95 #endif // #ifndef BOOST_CLBL_TRTS_IS_LVALUE_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_lvalue_reference_member_v
typename detail::traits< detail::shallow_decay< T > >::is_lvalue_reference_member type