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_ADD_MEMBER_CONST_HPP
0010 #define BOOST_CLBL_TRTS_ADD_MEMBER_CONST_HPP
0011 
0012 #include <boost/callable_traits/detail/core.hpp>
0013 
0014 namespace boost { namespace callable_traits {
0015 
0016 //[ add_member_const_hpp
0017 /*`
0018 [section:ref_add_member_const add_member_const]
0019 [heading Header]
0020 ``#include <boost/callable_traits/add_member_const.hpp>``
0021 [heading Definition]
0022 */
0023 
0024 template<typename T>
0025 using add_member_const_t = //see below
0026 //<-
0027 #ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
0028 
0029     detail::sfinae_try<
0030         typename detail::traits<T>::add_member_const,
0031 
0032         detail::fail_when_same<typename detail::traits<T>::add_member_const,
0033             detail::abominable_functions_not_supported_on_this_compiler,
0034             this_compiler_doesnt_support_abominable_function_types>,
0035 
0036         detail::fail_if_invalid<typename detail::traits<T>::add_member_const,
0037             member_qualifiers_are_illegal_for_this_type>>;
0038 #else
0039 
0040     detail::try_but_fail_if_invalid<
0041         typename detail::traits<T>::add_member_const,
0042         member_qualifiers_are_illegal_for_this_type>;
0043 
0044 #endif // #ifdef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
0045 
0046 namespace detail {
0047 
0048     template<typename T, typename = std::false_type>
0049     struct add_member_const_impl {};
0050 
0051     template<typename T>
0052     struct add_member_const_impl <T, typename std::is_same<
0053         add_member_const_t<T>, detail::dummy>::type>
0054     {
0055         using type = add_member_const_t<T>;
0056     };
0057 }
0058 
0059 //->
0060 
0061 template<typename T>
0062 struct add_member_const : detail::add_member_const_impl<T> {};
0063 
0064 //<-
0065 }} // namespace boost::callable_traits
0066 //->
0067 
0068 
0069 /*`
0070 [heading Constraints]
0071 * `T` must be a function type or a member function pointer type
0072 * If `T` is a pointer, it may not be cv/ref qualified
0073 
0074 [heading Behavior]
0075 * A substitution failure occurs if the constraints are violated.
0076 * Adds a member `const` qualifier to `T`, if not already present.
0077 
0078 [heading Input/Output Examples]
0079 [table
0080     [[`T`]                              [`add_member_const_t<T>`]]
0081     [[`int()`]                          [`int() const`]]
0082     [[`int(foo::*)()`]                  [`int(foo::*)() const`]]
0083     [[`int(foo::*)() &`]                [`int(foo::*)() const &`]]
0084     [[`int(foo::*)() &&`]               [`int(foo::*)() const &&`]]
0085     [[`int(foo::*)() const`]            [`int(foo::*)() const`]]
0086     [[`int(foo::*)() volatile`]         [`int(foo::*)() const volatile`]]
0087     [[`int(foo::*)() transaction_safe`] [`int(foo::*)() const transaction_safe`]]
0088     [[`int`]                            [(substitution failure)]]
0089     [[`int (&)()`]                      [(substitution failure)]]
0090     [[`int (*)()`]                      [(substitution failure)]]
0091     [[`int foo::*`]                     [(substitution failure)]]
0092     [[`int (foo::* const)()`]           [(substitution failure)]]
0093 ]
0094 
0095 [heading Example Program]
0096 [import ../example/add_member_const.cpp]
0097 [add_member_const]
0098 [endsect]
0099 */
0100 //]
0101 
0102 #endif // #ifndef BOOST_CLBL_TRTS_ADD_MEMBER_CONST_HPP
0103 
0104 
0105