Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*
0002 @file is_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_IS_NOEXCEPT_HPP
0011 #define BOOST_CLBL_TRTS_IS_NOEXCEPT_HPP
0012 
0013 #include <boost/callable_traits/detail/core.hpp>
0014 
0015 namespace boost { namespace callable_traits {
0016 
0017 //[ is_noexcept_hpp
0018 /*`[section:ref_is_noexcept is_noexcept]
0019 [heading Header]
0020 ``#include <boost/callable_traits/is_noexcept.hpp>``
0021 [heading Definition]
0022 */
0023 
0024 // inherits from either std::true_type or std::false_type
0025 template<typename T>
0026 struct is_noexcept;
0027 
0028 //<-
0029 template<typename T>
0030 struct is_noexcept : detail::traits<detail::shallow_decay<T>>::is_noexcept {
0031     using type = typename detail::traits<
0032         detail::shallow_decay<T>>::is_noexcept;
0033 };
0034 
0035 #ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
0036 
0037 template<typename T>
0038 struct is_noexcept_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_noexcept_v = //see below
0051 //<-
0052     detail::traits<detail::shallow_decay<T>>::is_noexcept::value;
0053 
0054 #endif
0055 
0056 }} // namespace boost::callable_traits
0057 //->
0058 
0059 /*`
0060 [heading Constraints]
0061 * none
0062 *
0063 [heading Behavior]
0064 * `is_noexcept<T>::value` is `true` when either: 
0065   * `T` is a function type, function pointer type, function reference type, or member function pointer type where the function has a `noexcept` specifier
0066   * `T` is a function object with a non-overloaded `operator()`, where the `operator()` has a `noexcept` specifier
0067 * On compilers that support variable templates, `is_noexcept_v<T>` is equivalent to `is_noexcept<T>::value`.
0068 
0069 [heading Input/Output Examples]
0070 [table
0071     [[`T`]                              [`is_noexcept_v<T>`]]
0072     [[`int() const noexcept`]           [`true`]]
0073     [[`int(* const &)() noexcept`]      [`true`]]
0074     [[`int(&)() noexcept`]              [`true`]]
0075     [[`int(foo::*)() noexcept`]         [`true`]]
0076     [[`int() const`]                    [`false`]]
0077     [[`int() volatile`]                 [`false`]]
0078     [[`int(foo::*)() const`]            [`false`]]
0079     [[`int() const`]                    [`false`]]
0080     [[`int() volatile`]                 [`false`]]
0081     [[`int() &`]                        [`false`]]
0082     [[`int(*)()`]                       [`false`]]
0083     [[`int`]                            [`false`]]
0084     [[`int foo::*`]                     [`false`]]
0085     [[`const int foo::*`]               [`false`]]
0086 ]
0087 
0088 [heading Example Program]
0089 [import ../example/is_noexcept.cpp]
0090 [is_noexcept]
0091 [endsect]
0092 */
0093 //]
0094 
0095 #endif // #ifndef BOOST_CLBL_TRTS_IS_NOEXCEPT_HPP