1 /* 2 @file remove_noexcept 3 4 @Copyright Barrett Adair 2015-2017 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_REMOVE_NOEXCEPT_HPP 11 #define BOOST_CLBL_TRTS_REMOVE_NOEXCEPT_HPP 12 13 #include <boost/callable_traits/detail/core.hpp> 14 15 namespace boost { namespace callable_traits { 16 17 BOOST_CLBL_TRTS_DEFINE_SFINAE_ERROR_ORIGIN(remove_noexcept) 18 BOOST_CLBL_TRTS_SFINAE_MSG(remove_noexcept, cannot_remove_noexcept_from_this_type) 19 20 //[ remove_noexcept_hpp 21 /*` 22 [section:ref_remove_noexcept remove_noexcept] 23 [heading Header] 24 ``#include <boost/callable_traits/remove_noexcept.hpp>`` 25 [heading Definition] 26 */ 27 28 template<typename T> 29 using remove_noexcept_t = //see below 30 //<- 31 detail::try_but_fail_if_invalid< 32 typename detail::traits<T>::remove_noexcept, 33 cannot_remove_noexcept_from_this_type>; 34 35 namespace detail { 36 37 template<typename T, typename = std::false_type> 38 struct remove_noexcept_impl {}; 39 40 template<typename T> 41 struct remove_noexcept_impl <T, typename std::is_same< 42 remove_noexcept_t<T>, detail::dummy>::type> 43 { 44 using type = remove_noexcept_t<T>; 45 }; 46 } 47 48 //-> 49 50 template<typename T> 51 struct remove_noexcept : detail::remove_noexcept_impl<T> {}; 52 53 //<- 54 }} // namespace boost::callable_traits 55 //-> 56 57 /*` 58 59 [heading Constraints] 60 * `T` must be one of the following: 61 * function type 62 * function pointer type 63 * function reference type 64 * member function pointer type 65 * If `T` is a pointer, it may not be cv/ref qualified 66 67 [heading Behavior] 68 * A substitution failure occurs if the constraints are violated. 69 * Removes the `noexcept` specifier from `T`, if present. 70 71 [heading Input/Output Examples] 72 [table 73 [[`T`] [`remove_noexcept_t<T>`]] 74 [[`int() const noexcept`] [`int() const`]] 75 [[`int(*)() noexcept`] [`int(*)()`]] 76 [[`int(&)() noexcept`] [`int(&)()`]] 77 [[`int(foo::*)() noexcept`] [`int(foo::*)()`]] 78 [[`int() const`] [`int() const`]] 79 [[`int(*)()`] [`int(*)()`]] 80 [[`int(&)()`] [`int(&)()`]] 81 [[`int`] [(substitution failure)]] 82 [[`int foo::*`] [(substitution failure)]] 83 [[`int (foo::* const)()`] [(substitution failure)]] 84 ] 85 86 [heading Example Program] 87 [import ../example/remove_noexcept.cpp] 88 [remove_noexcept] 89 [endsect] 90 */ 91 //] 92 93 #endif // #ifndef BOOST_CLBL_TRTS_REMOVE_NOEXCEPT_HPP 94