Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/metaprogramming/logical.hpp
40930 views
1
/*
2
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*
23
*/
24
25
#ifndef SHARE_METAPROGRAMMING_LOGICAL_HPP
26
#define SHARE_METAPROGRAMMING_LOGICAL_HPP
27
28
// Stand-ins for C++17 logical operations on types.
29
30
#include <type_traits>
31
32
// Stand-in for C++17 std::bool_constant<value>.
33
template<bool Value>
34
using BoolConstant = std::integral_constant<bool, Value>;
35
36
// Stand-in for C++17 std::conjunction<T...>
37
template<typename... T>
38
struct Conjunction : public std::true_type {};
39
40
template<typename T1>
41
struct Conjunction<T1> : public T1 {};
42
43
template<typename T1, typename... T>
44
struct Conjunction<T1, T...> :
45
public std::conditional_t<bool(T1::value), Conjunction<T...>, T1>
46
{};
47
48
// Stand-in for C++17 std::disjunction<T...>.
49
template<typename... T>
50
struct Disjunction : public std::false_type {};
51
52
template<typename T1>
53
struct Disjunction<T1> : public T1 {};
54
55
template<typename T1, typename... T>
56
struct Disjunction<T1, T...> :
57
public std::conditional_t<bool(T1::value), T1, Disjunction<T...>>
58
{};
59
60
// Stand-in for C++17 std::negation<T>.
61
template<typename T>
62
using Negation = BoolConstant<!bool(T::value)>;
63
64
#endif // SHARE_METAPROGRAMMING_LOGICAL_HPP
65
66