disjunction.hpp 916 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. Copyright Barrett Adair 2015-2017
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
  5. */
  6. #ifndef BOOST_CLBL_TRTS_DETAIL_POLYFILLS_DISJUNCTION_HPP
  7. #define BOOST_CLBL_TRTS_DETAIL_POLYFILLS_DISJUNCTION_HPP
  8. #undef BOOST_CLBL_TRTS_DISJUNCTION
  9. #define BOOST_CLBL_TRTS_DISJUNCTION(...) \
  10. ::boost::callable_traits::detail::disjunction<__VA_ARGS__>
  11. namespace boost { namespace callable_traits { namespace detail {
  12. //polyfill for C++17 std::disjunction
  13. template<typename...>
  14. struct disjunction : std::false_type {};
  15. template<typename T>
  16. struct disjunction<T> : T {};
  17. template<typename T, typename... Ts>
  18. struct disjunction<T, Ts...>
  19. : std::conditional<T::value != false, T, disjunction<Ts...>>::type {};
  20. }}} // namespace boost::callable_traits::detail
  21. #endif // #ifndef BOOST_CLBL_TRTS_DETAIL_POLYFILLS_DISJUNCTION_HPP