Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*
0002 @file add_noexcept
0003 
0004 @Copyright Barrett Adair 2015-2017
0005 Distributed under the Boost Software License, Version 1.0.
0006 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
0007 
0008 */
0009 
0010 #ifndef BOOST_CLBL_TRTS_ADD_NOEXCEPT_HPP
0011 #define BOOST_CLBL_TRTS_ADD_NOEXCEPT_HPP
0012 
0013 #include <boost/callable_traits/detail/core.hpp>
0014 
0015 namespace boost { namespace callable_traits {
0016 
0017 BOOST_CLBL_TRTS_DEFINE_SFINAE_ERROR_ORIGIN(add_noexcept)
0018 BOOST_CLBL_TRTS_SFINAE_MSG(add_noexcept, cannot_add_noexcept_to_this_type)
0019 
0020 #ifndef BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES
0021 template<typename T>
0022 struct add_noexcept_t {
0023     static_assert(std::is_same<T, detail::dummy>::value,
0024         "noexcept types not supported by this configuration.");
0025 };
0026 
0027 template<typename T>
0028 struct add_noexcept {
0029     static_assert(std::is_same<T, detail::dummy>::value,
0030         "noexcept types not supported by this configuration.");
0031 };
0032 
0033 #else
0034 
0035 //[ add_noexcept_hpp
0036 /*`
0037 [section:ref_add_noexcept add_noexcept]
0038 [heading Header]
0039 ``#include <boost/callable_traits/add_noexcept.hpp>``
0040 [heading Definition]
0041 */
0042 
0043 template<typename T>
0044 using add_noexcept_t = //see below
0045 //<-
0046     detail::try_but_fail_if_invalid<
0047         typename detail::traits<T>::add_noexcept,
0048         cannot_add_noexcept_to_this_type>;
0049 
0050 namespace detail {
0051 
0052     template<typename T, typename = std::false_type>
0053     struct add_noexcept_impl {};
0054 
0055     template<typename T>
0056     struct add_noexcept_impl <T, typename std::is_same<
0057         add_noexcept_t<T>, detail::dummy>::type>
0058     {
0059         using type = add_noexcept_t<T>;
0060     };
0061 }
0062 //->
0063 
0064 template<typename T>
0065 struct add_noexcept : detail::add_noexcept_impl<T> {};
0066 
0067 //<-
0068 #endif // #ifdef BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES
0069 }} // namespace boost::callable_traits
0070 //->
0071 
0072 /*`
0073 [heading Constraints]
0074 * `T` must be one of the following:
0075   * function type
0076   * function pointer type
0077   * function reference type
0078   * member function pointer type
0079 * If `T` is a pointer, it may not be cv/ref qualified
0080 
0081 [heading Behavior]
0082 * A substitution failure occurs if the constraints are violated.
0083 * Adds a `noexcept` specifier to `T`, if not already present.
0084 
0085 [heading Input/Output Examples]
0086 [table
0087     [[`T`]                                    [`add_noexcept_t<T>`]]
0088     [[`int()`]                                [`int() noexcept`]]
0089     [[`int (&)()`]                            [`int(&)() noexcept`]]
0090     [[`int (*)()`]                            [`int(*)() noexcept`]]
0091     [[`int(foo::*)()`]                        [`int(foo::*)() noexcept`]]
0092     [[`int(foo::*)() &`]                      [`int(foo::*)() & noexcept`]]
0093     [[`int(foo::*)() &&`]                     [`int(foo::*)() && noexcept`]]
0094     [[`int(foo::*)() const transaction_safe`] [`int(foo::*)() const transaction_safe noexcept`]]
0095     [[`int(foo::*)() noexcept`]               [`int(foo::*)() noexcept`]]
0096     [[`int`]                                  [(substitution failure)]]
0097     [[`int foo::*`]                           [(substitution failure)]]
0098     [[`int (*&)()`]                           [(substitution failure)]]
0099 ]
0100 
0101 [heading Example Program]
0102 [import ../example/add_noexcept.cpp]
0103 [add_noexcept]
0104 [endsect]
0105 */
0106 //]
0107 
0108 #endif // #ifndef BOOST_CLBL_TRTS_ADD_NOEXCEPT_HPP