Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:05

0001 
0002 //              Copyright Catch2 Authors
0003 // Distributed under the Boost Software License, Version 1.0.
0004 //   (See accompanying file LICENSE.txt or copy at
0005 //        https://www.boost.org/LICENSE_1_0.txt)
0006 
0007 // SPDX-License-Identifier: BSL-1.0
0008 #ifndef CATCH_LOGICAL_TRAITS_HPP_INCLUDED
0009 #define CATCH_LOGICAL_TRAITS_HPP_INCLUDED
0010 
0011 #include <type_traits>
0012 
0013 namespace Catch {
0014 namespace Detail {
0015 
0016 #if defined( __cpp_lib_logical_traits ) && __cpp_lib_logical_traits >= 201510
0017 
0018     using std::conjunction;
0019     using std::disjunction;
0020     using std::negation;
0021 
0022 #else
0023 
0024     template <class...> struct conjunction : std::true_type {};
0025     template <class B1> struct conjunction<B1> : B1 {};
0026     template <class B1, class... Bn>
0027     struct conjunction<B1, Bn...>
0028         : std::conditional_t<bool( B1::value ), conjunction<Bn...>, B1> {};
0029 
0030     template <class...> struct disjunction : std::false_type {};
0031     template <class B1> struct disjunction<B1> : B1 {};
0032     template <class B1, class... Bn>
0033     struct disjunction<B1, Bn...>
0034         : std::conditional_t<bool( B1::value ), B1, disjunction<Bn...>> {};
0035 
0036     template <class B>
0037     struct negation : std::integral_constant<bool, !bool(B::value)> {};
0038 
0039 #endif
0040 
0041 } // namespace Detail
0042 } // namespace Catch
0043 
0044 #endif // CATCH_LOGICAL_TRAITS_HPP_INCLUDED