ttg 1.0.0
Template Task Graph (TTG): flowgraph-based programming model for high-performance distributed-memory algorithms
Loading...
Searching...
No Matches
is_noexcept.hpp
Go to the documentation of this file.
1/*
2@file is_noexcept
3
4@Copyright Barrett Adair 2015-2017
5Distributed 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_IS_NOEXCEPT_HPP
11#define BOOST_CLBL_TRTS_IS_NOEXCEPT_HPP
12
14
15namespace boost { namespace callable_traits {
16
17//[ is_noexcept_hpp
18/*`[section:ref_is_noexcept is_noexcept]
19[heading Header]
20``#include <boost/callable_traits/is_noexcept.hpp>``
21[heading Definition]
22*/
23
24// inherits from either std::true_type or std::false_type
25template<typename T>
26struct is_noexcept;
27
28//<-
29template<typename T>
30struct is_noexcept : detail::traits<detail::shallow_decay<T>>::is_noexcept {
31 using type = typename detail::traits<
32 detail::shallow_decay<T>>::is_noexcept;
33};
34
35#ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
36
37template<typename T>
38struct is_noexcept_v {
39 static_assert(std::is_same<T, detail::dummy>::value,
40 "Variable templates not supported on this compiler.");
41};
42
43#else
44//->
45// only available when variable templates are supported
46template<typename T>
47//<-
49//->
50constexpr bool is_noexcept_v = //see below
51//<-
52 detail::traits<detail::shallow_decay<T>>::is_noexcept::value;
53
54#endif
55
56}} // namespace boost::callable_traits
57//->
58
59/*`
60[heading Constraints]
61* none
62*
63[heading Behavior]
64* `is_noexcept<T>::value` is `true` when either:
65 * `T` is a function type, function pointer type, function reference type, or member function pointer type where the function has a `noexcept` specifier
66 * `T` is a function object with a non-overloaded `operator()`, where the `operator()` has a `noexcept` specifier
67* On compilers that support variable templates, `is_noexcept_v<T>` is equivalent to `is_noexcept<T>::value`.
68
69[heading Input/Output Examples]
70[table
71 [[`T`] [`is_noexcept_v<T>`]]
72 [[`int() const noexcept`] [`true`]]
73 [[`int(* const &)() noexcept`] [`true`]]
74 [[`int(&)() noexcept`] [`true`]]
75 [[`int(foo::*)() noexcept`] [`true`]]
76 [[`int() const`] [`false`]]
77 [[`int() volatile`] [`false`]]
78 [[`int(foo::*)() const`] [`false`]]
79 [[`int() const`] [`false`]]
80 [[`int() volatile`] [`false`]]
81 [[`int() &`] [`false`]]
82 [[`int(*)()`] [`false`]]
83 [[`int`] [`false`]]
84 [[`int foo::*`] [`false`]]
85 [[`const int foo::*`] [`false`]]
86]
87
88[heading Example Program]
89[import ../example/is_noexcept.cpp]
90[is_noexcept]
91[endsect]
92*/
93//]
94
95#endif // #ifndef BOOST_CLBL_TRTS_IS_NOEXCEPT_HPP
#define BOOST_CLBL_TRAITS_INLINE_VAR
Definition config.hpp:27
typename std::remove_cv< typename std::remove_reference< T >::type >::type shallow_decay
Definition utility.hpp:79
typename BOOST_CLBL_TRTS_DISJUNCTION(function_object< unwrap_reference< T > >, function< T >, pmf< T >, pmd< T >, default_callable_traits< T >)::traits traits
Definition traits.hpp:25
BOOST_CLBL_TRAITS_INLINE_VAR constexpr bool is_noexcept_v
typename detail::traits< detail::shallow_decay< T > >::is_noexcept type