Path: blob/master/src/hotspot/share/metaprogramming/logical.hpp
40930 views
/*1* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_METAPROGRAMMING_LOGICAL_HPP25#define SHARE_METAPROGRAMMING_LOGICAL_HPP2627// Stand-ins for C++17 logical operations on types.2829#include <type_traits>3031// Stand-in for C++17 std::bool_constant<value>.32template<bool Value>33using BoolConstant = std::integral_constant<bool, Value>;3435// Stand-in for C++17 std::conjunction<T...>36template<typename... T>37struct Conjunction : public std::true_type {};3839template<typename T1>40struct Conjunction<T1> : public T1 {};4142template<typename T1, typename... T>43struct Conjunction<T1, T...> :44public std::conditional_t<bool(T1::value), Conjunction<T...>, T1>45{};4647// Stand-in for C++17 std::disjunction<T...>.48template<typename... T>49struct Disjunction : public std::false_type {};5051template<typename T1>52struct Disjunction<T1> : public T1 {};5354template<typename T1, typename... T>55struct Disjunction<T1, T...> :56public std::conditional_t<bool(T1::value), T1, Disjunction<T...>>57{};5859// Stand-in for C++17 std::negation<T>.60template<typename T>61using Negation = BoolConstant<!bool(T::value)>;6263#endif // SHARE_METAPROGRAMMING_LOGICAL_HPP646566