/* @Copyright Barrett Adair 2015-2017 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_CLBL_TRTS_HAS_VOID_RETURN_HPP #define BOOST_CLBL_TRTS_HAS_VOID_RETURN_HPP #include namespace boost { namespace callable_traits { //[ has_void_return_hpp /*`[section:ref_has_void_return has_void_return] [heading Header] ``#include `` [heading Definition] */ // inherits from either std::true_type or std::false_type template struct has_void_return; //<- template struct has_void_return : std::is_same>::return_type, void> {}; #ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES template struct has_void_return_v { static_assert(std::is_same::value, "Variable templates not supported on this compiler."); }; #else //-> // only available when variable templates are supported template //<- BOOST_CLBL_TRAITS_INLINE_VAR //-> constexpr bool has_void_return_v = //see below //<- std::is_same>::return_type, void>::value; #endif }} // namespace boost::callable_traits //-> /*` [heading Constraints] * none [heading Behavior] * `std::false_type` is inherited by `has_void_return` and is aliased by `typename has_void_return::type`, except when one of the following criteria is met, in which case `std::true_type` would be similarly inherited and aliased: * `T` is a function, function pointer, or function reference where the function's return type is `void`. * `T` is a pointer to a member function whose return type is `void`. * `T` is a function object with a non-overloaded `operator()`, where the `operator()` function returns `void`. * On compilers that support variable templates, `has_void_return_v` is equivalent to `has_void_return::value`. [heading Input/Output Examples] [table [[`T`] [`has_void_return_v`]] [[`void()`] [`true`]] [[`void(int) const`] [`true`]] [[`void(* const &)()`] [`true`]] [[`void(&)()`] [`true`]] [[`void(foo::*)() const`] [`true`]] [[`int(*)()`] [`false`]] [[`int(*&)()`] [`false`]] [[`int`] [`false`]] [[`int foo::*`] [`false`]] [[`void* foo::*`] [`false`]] ] [heading Example Program] [import ../example/has_void_return.cpp] [has_void_return] [endsect] */ //] #endif