BDE 4.39.x 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// clang-format off
69// Include version that can be compiled with C++03
70// Generated on Mon Jan 13 08:31:25 2025
71// Command line: sim_cpp11_features.pl bslmf_disjunction.h
72
73# define COMPILING_BSLMF_DISJUNCTION_H
75# undef COMPILING_BSLMF_DISJUNCTION_H
76
77// clang-format on
78#else
79
80namespace bsl {
81
82#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
83
84using std::disjunction;
85using std::disjunction_v;
86
87#else
88
89 // ==================
90 // struct disjunction
91 // ==================
92
93// forward declaration (required for C++03)
94#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES // $var-args=10
95template <class... B>
97#endif
98
99// 0 args specialization
100#ifdef BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES
101template <class...>
102struct disjunction : false_type {
103};
104#else
105template <>
107};
108#endif
109
110// 1 arg specialization
111template <class B1>
112struct disjunction<B1> : B1 {
113};
114
115// other cases
116#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES // $local-var-args=8
117template <class B1, class B2, class... Bn>
118struct disjunction<B1, B2, Bn...> :
119 conditional<bool(B1::value), B1, disjunction<B2, Bn...> >::type {
120};
121#endif
122
123#ifdef BSLS_COMPILERFEATURES_SUPPORT_VARIABLE_TEMPLATES
124template <class... B>
126constexpr bool disjunction_v = disjunction<B...>::value;
127#endif
128
129#endif
130
131} // close namespace bsl
132
133#endif // End C++11 code
134
135#endif
136
137// ----------------------------------------------------------------------------
138// Copyright 2024 Bloomberg Finance L.P.
139//
140// Licensed under the Apache License, Version 2.0 (the "License");
141// you may not use this file except in compliance with the License.
142// You may obtain a copy of the License at
143//
144// http://www.apache.org/licenses/LICENSE-2.0
145//
146// Unless required by applicable law or agreed to in writing, software
147// distributed under the License is distributed on an "AS IS" BASIS,
148// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
149// See the License for the specific language governing permissions and
150// limitations under the License.
151// ----------------------------- END-OF-FILE ----------------------------------
152
153/** @} */
154/** @} */
155/** @} */
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
#define BSLS_KEYWORD_INLINE_VARIABLE
Definition bsls_keyword.h:665
Definition bdlat_valuetypefunctions.h:939
Definition bslmf_conditional.h:123
Definition bslmf_disjunction.h:106
Definition bslmf_disjunction.h:96
Definition bslmf_integralconstant.h:261