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_VOLATILE_MEMBER_HPP 11 #define BOOST_CLBL_TRTS_IS_VOLATILE_MEMBER_HPP 12 13 #include <boost/callable_traits/detail/core.hpp> 14 15 namespace boost { namespace callable_traits { 16 17 //[ is_volatile_member_hpp 18 /*`[section:ref_is_volatile_member is_volatile_member] 19 [heading Header] 20 ``#include <boost/callable_traits/is_volatile_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_volatile_member; 28 29 //<- 30 template<typename T> 31 struct is_volatile_member : detail::traits< 32 detail::shallow_decay<T>>::is_volatile_member { 33 34 using type = typename detail::traits< 35 detail::shallow_decay<T>>::is_volatile_member; 36 }; 37 38 #ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES 39 40 template<typename T> 41 struct is_volatile_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 //<- 51 BOOST_CLBL_TRAITS_INLINE_VAR 52 //-> 53 constexpr bool is_volatile_member_v = //see below 54 //<- 55 detail::traits<detail::shallow_decay<T>>::is_volatile_member::value; 56 57 #endif 58 59 }} // namespace boost::callable_traits 60 //-> 61 62 63 /*` 64 [heading Constraints] 65 * none 66 67 [heading Behavior] 68 * `is_volatile_member<T>::value` is `true` when either: 69 * `T` is a function type with a `volatile` member qualifier 70 * `T` is a pointer to a member function with a `volatile` member qualifier 71 * `T` is a function object with a non-overloaded `operator()`, where the `operator()` has a `volatile` member qualifier 72 * On compilers that support variable templates, `is_volatile_member_v<T>` is equivalent to `is_volatile_member<T>::value`. 73 74 [heading Input/Output Examples] 75 [table 76 [[`T`] [`is_volatile_member_v<T>`]] 77 [[`int() volatile`] [`true`]] 78 [[`int() const volatile`] [`true`]] 79 [[`int() volatile &&`] [`true`]] 80 [[`int(foo::*)() volatile`] [`true`]] 81 [[`int(foo::* const)() volatile`] [`true`]] 82 [[`int(foo::*)() const volatile`] [`true`]] 83 [[`int(foo::*)() const volatile &&`][`true`]] 84 [[`int()`] [`false`]] 85 [[`int() const`] [`false`]] 86 [[`int() &&`] [`false`]] 87 [[`int(*)()`] [`false`]] 88 [[`int`] [`false`]] 89 [[`int foo::*`] [`false`]] 90 [[`volatile int foo::*`] [`false`]] 91 ] 92 93 [heading Example Program] 94 [import ../example/is_volatile_member.cpp] 95 [is_volatile_member] 96 [endsect] 97 */ 98 //] 99 100 #endif // #ifndef BOOST_CLBL_TRTS_IS_VOLATILE_MEMBER_HPP 101