BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslmf_disjunction.h
Go to the documentation of this file.
1/// @file bslmf_disjunction.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bslmf_disjunction.h -*-C++-*-
8#ifndef INCLUDED_BSLMF_DISJUNCTION
9#define INCLUDED_BSLMF_DISJUNCTION
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup bslmf_disjunction bslmf_disjunction
15/// @brief Provide the logical disjunction (OR) for type traits.
16/// @addtogroup bsl
17/// @{
18/// @addtogroup bslmf
19/// @{
20/// @addtogroup bslmf_disjunction
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bslmf_disjunction-purpose"> Purpose</a>
25/// * <a href="#bslmf_disjunction-classes"> Classes </a>
26/// * <a href="#bslmf_disjunction-description"> Description </a>
27///
28/// # Purpose {#bslmf_disjunction-purpose}
29/// Provide the logical disjunction (OR) for type traits.
30///
31/// # Classes {#bslmf_disjunction-classes}
32///
33/// - bsl::disjunction: forms the logical OR of the specified type traits
34/// - bsl::disjunction_v: the result value of the `disjunction` meta-function
35///
36/// # Description {#bslmf_disjunction-description}
37/// This component makes available the functionality provided by
38/// the `std::disjunction` meta-function in all C++ language modes -
39/// `std::disjunction` is available only starting from C++17.
40/// @}
41/** @} */
42/** @} */
43
44/** @addtogroup bsl
45 * @{
46 */
47/** @addtogroup bslmf
48 * @{
49 */
50/** @addtogroup bslmf_disjunction
51 * @{
52 */
53
54#include <bslscm_version.h>
55
57#include <bsls_keyword.h>
59
60#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
61#include <type_traits>
62#else
63#include <bslmf_conditional.h>
65#endif
66
67#if BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
68// Include version that can be compiled with C++03
69// Generated on Wed Feb 21 06:28:04 2024
70// Command line: sim_cpp11_features.pl bslmf_disjunction.h
71# define COMPILING_BSLMF_DISJUNCTION_H
73# undef COMPILING_BSLMF_DISJUNCTION_H
74#else
75
76namespace bsl {
77
78#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
79
80using std::disjunction;
81using std::disjunction_v;
82
83#else
84
85 // ==================
86 // struct disjunction
87 // ==================
88
89// forward declaration (required for C++03)
90#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES // $var-args=10
91template <class... B>
93#endif
94
95// 0 args specialization
96#ifdef BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES
97template <class...>
98struct disjunction : false_type {
99};
100#else
101template <>
103};
104#endif
105
106// 1 arg specialization
107template <class B1>
108struct disjunction<B1> : B1 {
109};
110
111// other cases
112#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES // $local-var-args=8
113template <class B1, class B2, class... Bn>
114struct disjunction<B1, B2, Bn...> :
115 conditional<bool(B1::value), B1, disjunction<B2, Bn...> >::type {
116};
117#endif
118
119#ifdef BSLS_COMPILERFEATURES_SUPPORT_VARIABLE_TEMPLATES
120template <class... B>
122constexpr bool disjunction_v = disjunction<B...>::value;
123#endif
124
125#endif
126
127} // close namespace bsl
128
129#endif // End C++11 code
130
131#endif
132
133// ----------------------------------------------------------------------------
134// Copyright 2024 Bloomberg Finance L.P.
135//
136// Licensed under the Apache License, Version 2.0 (the "License");
137// you may not use this file except in compliance with the License.
138// You may obtain a copy of the License at
139//
140// http://www.apache.org/licenses/LICENSE-2.0
141//
142// Unless required by applicable law or agreed to in writing, software
143// distributed under the License is distributed on an "AS IS" BASIS,
144// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
145// See the License for the specific language governing permissions and
146// limitations under the License.
147// ----------------------------- END-OF-FILE ----------------------------------
148
149/** @} */
150/** @} */
151/** @} */
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#define BSLS_KEYWORD_INLINE_VARIABLE
Definition bsls_keyword.h:623
Definition bdlb_printmethods.h:283
Definition bslmf_conditional.h:120
Definition bslmf_disjunction.h:102
Definition bslmf_disjunction.h:92
Definition bslmf_integralconstant.h:244