ttg 1.0.0
Template Task Graph (TTG): flowgraph-based programming model for high-performance distributed-memory algorithms
Loading...
Searching...
No Matches
has_void_return.hpp
Go to the documentation of this file.
1/*
2
3@Copyright Barrett Adair 2015-2017
4Distributed under the Boost Software License, Version 1.0.
5(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
6
7*/
8
9#ifndef BOOST_CLBL_TRTS_HAS_VOID_RETURN_HPP
10#define BOOST_CLBL_TRTS_HAS_VOID_RETURN_HPP
11
13
14namespace boost { namespace callable_traits {
15
16//[ has_void_return_hpp
17/*`[section:ref_has_void_return has_void_return]
18[heading Header]
19``#include <boost/callable_traits/has_void_return.hpp>``
20[heading Definition]
21*/
22
23// inherits from either std::true_type or std::false_type
24template<typename T>
25struct has_void_return;
26
27//<-
28template<typename T>
30 : std::is_same<typename detail::traits<
31 detail::shallow_decay<T>>::return_type, void> {};
32
33#ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
34
35template<typename T>
36struct has_void_return_v {
37 static_assert(std::is_same<T, detail::dummy>::value,
38 "Variable templates not supported on this compiler.");
39};
40
41#else
42//->
43
44// only available when variable templates are supported
45template<typename T>
46//<-
48//->
49constexpr bool has_void_return_v = //see below
50//<-
51 std::is_same<typename detail::traits<
52 detail::shallow_decay<T>>::return_type, void>::value;
53
54#endif
55
56}} // namespace boost::callable_traits
57//->
58
59
60/*`
61[heading Constraints]
62* none
63
64[heading Behavior]
65* `std::false_type` is inherited by `has_void_return<T>` and is aliased by `typename has_void_return<T>::type`, except when one of the following criteria is met, in which case `std::true_type` would be similarly inherited and aliased:
66 * `T` is a function, function pointer, or function reference where the function's return type is `void`.
67 * `T` is a pointer to a member function whose return type is `void`.
68 * `T` is a function object with a non-overloaded `operator()`, where the `operator()` function returns `void`.
69* On compilers that support variable templates, `has_void_return_v<T>` is equivalent to `has_void_return<T>::value`.
70
71[heading Input/Output Examples]
72[table
73 [[`T`] [`has_void_return_v<T>`]]
74 [[`void()`] [`true`]]
75 [[`void(int) const`] [`true`]]
76 [[`void(* const &)()`] [`true`]]
77 [[`void(&)()`] [`true`]]
78 [[`void(foo::*)() const`] [`true`]]
79 [[`int(*)()`] [`false`]]
80 [[`int(*&)()`] [`false`]]
81 [[`int`] [`false`]]
82 [[`int foo::*`] [`false`]]
83 [[`void* foo::*`] [`false`]]
84]
85
86[heading Example Program]
87[import ../example/has_void_return.cpp]
88[has_void_return]
89[endsect]
90*/
91//]
92
93#endif
#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 has_void_return_v