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)
9 #ifndef BOOST_CLBL_TRTS_HAS_MEMBER_QUALIFIERS_HPP
10 #define BOOST_CLBL_TRTS_HAS_MEMBER_QUALIFIERS_HPP
12 #include <boost/callable_traits/detail/core.hpp>
14 namespace boost { namespace callable_traits {
16 //[ has_member_qualifiers_hpp
17 /*`[section:ref_has_member_qualifiers has_member_qualifiers]
19 ``#include <boost/callable_traits/has_member_qualifiers.hpp>``
23 // inherits from either std::true_type or std::false_type
25 struct has_member_qualifiers;
29 struct has_member_qualifiers : detail::traits<
30 detail::shallow_decay<T>>::has_member_qualifiers {
32 using type = typename detail::traits<
33 detail::shallow_decay<T>>::has_member_qualifiers;
36 // older compilers don't support variable templates
37 #ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
40 struct has_member_qualifiers_v {
41 static_assert(std::is_same<T, detail::dummy>::value,
42 "Variable templates not supported on this compiler.");
47 // only available when variable templates are supported
50 BOOST_CLBL_TRAITS_INLINE_VAR
52 constexpr bool has_member_qualifiers_v = //see below
54 detail::traits<detail::shallow_decay<T>>::has_member_qualifiers::value;
58 }} // namespace boost::callable_traits
66 * `std::false_type` is inherited by `has_member_qualifiers<T>` and is aliased by `typename has_member_qualifiers<T>::type`, except when one of the following criteria is met, in which case `std::true_type` would be similarly inherited and aliased:
67 * `T` is a function with member qualifiers
68 * `T` is a member function pointer with member qualifiers
69 * `T` is a function object with a member-qualified `operator()`
70 * On compilers that support variable templates, `has_member_qualifiers_v<T>` is equivalent to `has_member_qualifiers<T>::value`.
72 [heading Input/Output Examples]
74 [[`T`] [`has_member_qualifiers_v<T>`]]
75 [[`void() const`] [`true`]]
76 [[`void() const transaction_safe`] [`true`]]
77 [[`void() volatile &&`] [`true`]]
78 [[`int(foo::*)() &`] [`true`]]
79 [[`void(foo::*)() const`] [`true`]]
80 [[`void(foo::*&)() const`] [`true`]]
81 [[`void(foo::* const)() const`] [`true`]]
82 [[`void()`] [`false`]]
83 [[`void() transaction_safe`] [`false`]]
84 [[`void(*)()`] [`false`]]
85 [[`void(*&)()`] [`false`]]
87 [[`const int`] [`false`]]
88 [[`int foo::*`] [`false`]]
89 [[`const int foo::*`] [`false`]]
92 [heading Example Program]
93 [import ../example/has_member_qualifiers.cpp]
94 [has_member_qualifiers]
99 #endif //BOOST_CLBL_TRTS_HAS_MEMBER_QUALIFIERS_HPP