Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:45

0001 /*
0002 
0003 @Copyright Barrett Adair 2015-2017
0004 Distributed under the Boost Software License, Version 1.0.
0005 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
0006 
0007 */
0008 
0009 #ifndef BOOST_CLBL_TRTS_IS_CONST_MEMBER_HPP
0010 #define BOOST_CLBL_TRTS_IS_CONST_MEMBER_HPP
0011 
0012 #include <boost/callable_traits/detail/core.hpp>
0013 
0014 namespace boost { namespace callable_traits {
0015 
0016 //[ is_const_member_hpp
0017 /*`[section:ref_is_const_member is_const_member]
0018 [heading Header]
0019 ``#include <boost/callable_traits/is_const_member.hpp>``
0020 [heading Definition]
0021 */
0022 
0023 // inherits from either std::true_type or std::false_type
0024 template<typename T>
0025 struct is_const_member;
0026 
0027 //<-
0028 template<typename T>
0029 struct is_const_member
0030     : detail::traits<detail::shallow_decay<T>>::is_const_member {
0031     using type = typename detail::traits<
0032         detail::shallow_decay<T>>::is_const_member;
0033 };
0034 
0035 #ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
0036 
0037 template<typename T>
0038 struct is_const_member_v {
0039     static_assert(std::is_same<T, detail::dummy>::value,
0040         "Variable templates not supported on this compiler.");
0041 };
0042 
0043 #else
0044 //->
0045 // only available when variable templates are supported
0046 template<typename T>
0047 //<-
0048 BOOST_CLBL_TRAITS_INLINE_VAR
0049 //->
0050 constexpr bool is_const_member_v = //see below
0051 //<-
0052     detail::traits<detail::shallow_decay<T>>::is_const_member::value;
0053 
0054 #endif
0055 
0056 }} // namespace boost::callable_traits
0057 //->
0058 
0059 /*`
0060 [heading Constraints]
0061 * none
0062 
0063 [heading Behavior]
0064 * `is_const_member<T>::value` is `true` when either:
0065   * `T` is a function type with a `const` member qualifier
0066   * `T` is a pointer to a member function with a `const` member qualifier
0067   * `T` is a function object with a non-overloaded `operator()`, where the `operator()` has a `const` member qualifier
0068 * On compilers that support variable templates, `is_const_member_v<T>` is equivalent to `is_const_member<T>::value`.
0069 
0070 [heading Input/Output Examples]
0071 [table
0072     [[`T`]                              [`is_const_member_v<T>`]]
0073     [[`int() const`]                    [`true`]]
0074     [[`int() const volatile`]           [`true`]]
0075     [[`int() const & transaction_safe`] [`true`]]
0076     [[`int() const &&`]                 [`true`]]
0077     [[`int(foo::*&)() const`]           [`true`]]
0078     [[`int(foo::*)() const volatile`]   [`true`]]
0079     [[`int(foo::*)() const volatile &&`][`true`]]
0080     [[`int(foo::* const)() const`]      [`true`]]
0081     [[`int()`]                          [`false`]]
0082     [[`int() volatile`]                 [`false`]]
0083     [[`int() &&`]                       [`false`]]
0084     [[`int(*)()`]                       [`false`]]
0085     [[`int`]                            [`false`]]
0086     [[`int foo::*`]                     [`false`]]
0087     [[`const int foo::*`]               [`false`]]
0088 ]
0089 
0090 [heading Example Program]
0091 [import ../example/is_const_member.cpp]
0092 [is_const_member]
0093 [endsect]
0094 */
0095 //]
0096 
0097 #endif // #ifndef BOOST_CLBL_TRTS_IS_CONST_MEMBER_HPP