|
||||
File indexing completed on 2025-01-30 09:34:24
0001 /* 0002 0003 @Copyright Barrett Adair 2015-2017 0004 Distributed under the Boost Software License, Version 1.0. 0005 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 0006 0007 */ 0008 0009 #ifndef BOOST_CLBL_TRTS_HAS_VOID_RETURN_HPP 0010 #define BOOST_CLBL_TRTS_HAS_VOID_RETURN_HPP 0011 0012 #include <boost/callable_traits/detail/core.hpp> 0013 0014 namespace boost { namespace callable_traits { 0015 0016 //[ has_void_return_hpp 0017 /*`[section:ref_has_void_return has_void_return] 0018 [heading Header] 0019 ``#include <boost/callable_traits/has_void_return.hpp>`` 0020 [heading Definition] 0021 */ 0022 0023 // inherits from either std::true_type or std::false_type 0024 template<typename T> 0025 struct has_void_return; 0026 0027 //<- 0028 template<typename T> 0029 struct has_void_return 0030 : std::is_same<typename detail::traits< 0031 detail::shallow_decay<T>>::return_type, void> {}; 0032 0033 #ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES 0034 0035 template<typename T> 0036 struct has_void_return_v { 0037 static_assert(std::is_same<T, detail::dummy>::value, 0038 "Variable templates not supported on this compiler."); 0039 }; 0040 0041 #else 0042 //-> 0043 0044 // only available when variable templates are supported 0045 template<typename T> 0046 //<- 0047 BOOST_CLBL_TRAITS_INLINE_VAR 0048 //-> 0049 constexpr bool has_void_return_v = //see below 0050 //<- 0051 std::is_same<typename detail::traits< 0052 detail::shallow_decay<T>>::return_type, void>::value; 0053 0054 #endif 0055 0056 }} // namespace boost::callable_traits 0057 //-> 0058 0059 0060 /*` 0061 [heading Constraints] 0062 * none 0063 0064 [heading Behavior] 0065 * `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: 0066 * `T` is a function, function pointer, or function reference where the function's return type is `void`. 0067 * `T` is a pointer to a member function whose return type is `void`. 0068 * `T` is a function object with a non-overloaded `operator()`, where the `operator()` function returns `void`. 0069 * On compilers that support variable templates, `has_void_return_v<T>` is equivalent to `has_void_return<T>::value`. 0070 0071 [heading Input/Output Examples] 0072 [table 0073 [[`T`] [`has_void_return_v<T>`]] 0074 [[`void()`] [`true`]] 0075 [[`void(int) const`] [`true`]] 0076 [[`void(* const &)()`] [`true`]] 0077 [[`void(&)()`] [`true`]] 0078 [[`void(foo::*)() const`] [`true`]] 0079 [[`int(*)()`] [`false`]] 0080 [[`int(*&)()`] [`false`]] 0081 [[`int`] [`false`]] 0082 [[`int foo::*`] [`false`]] 0083 [[`void* foo::*`] [`false`]] 0084 ] 0085 0086 [heading Example Program] 0087 [import ../example/has_void_return.cpp] 0088 [has_void_return] 0089 [endsect] 0090 */ 0091 //] 0092 0093 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |