disjunction.hpp
Go to the documentation of this file.
1 /*
2 Copyright Barrett Adair 2015-2017
3 
4 Distributed 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_DETAIL_POLYFILLS_DISJUNCTION_HPP
10 #define BOOST_CLBL_TRTS_DETAIL_POLYFILLS_DISJUNCTION_HPP
11 
12 #undef BOOST_CLBL_TRTS_DISJUNCTION
13 #define BOOST_CLBL_TRTS_DISJUNCTION(...) \
14  ::boost::callable_traits::detail::disjunction<__VA_ARGS__>
15 
16 namespace boost { namespace callable_traits { namespace detail {
17 
18 //polyfill for C++17 std::disjunction
19 template<typename...>
20 struct disjunction : std::false_type {};
21 
22 template<typename T>
23 struct disjunction<T> : T {};
24 
25 template<typename T, typename... Ts>
26 struct disjunction<T, Ts...>
27  : std::conditional<T::value != false, T, disjunction<Ts...>>::type {};
28 
29 }}} // namespace boost::callable_traits::detail
30 
31 #endif // #ifndef BOOST_CLBL_TRTS_DETAIL_POLYFILLS_DISJUNCTION_HPP