BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslmf_conjunction.h
Go to the documentation of this file.
1/// @file bslmf_conjunction.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bslmf_conjunction.h -*-C++-*-
8#ifndef INCLUDED_BSLMF_CONJUNCTION
9#define INCLUDED_BSLMF_CONJUNCTION
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup bslmf_conjunction bslmf_conjunction
15/// @brief Provide the logical conjunction (AND) for type traits.
16/// @addtogroup bsl
17/// @{
18/// @addtogroup bslmf
19/// @{
20/// @addtogroup bslmf_conjunction
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bslmf_conjunction-purpose"> Purpose</a>
25/// * <a href="#bslmf_conjunction-classes"> Classes </a>
26/// * <a href="#bslmf_conjunction-description"> Description </a>
27///
28/// # Purpose {#bslmf_conjunction-purpose}
29/// Provide the logical conjunction (AND) for type traits.
30///
31/// # Classes {#bslmf_conjunction-classes}
32///
33/// - bsl::conjunction: forms the logical AND of the specified type traits
34/// - bsl::conjunction_v: the result value of the `conjunction` meta-function
35///
36/// # Description {#bslmf_conjunction-description}
37/// This component makes available the functionality provided by
38/// the `std::conjunction` meta-function in all C++ language modes -
39/// `std::conjunction` is available only starting from C++17.
40/// @}
41/** @} */
42/** @} */
43
44/** @addtogroup bsl
45 * @{
46 */
47/** @addtogroup bslmf
48 * @{
49 */
50/** @addtogroup bslmf_conjunction
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 Tue Feb 20 12:10:48 2024
70// Command line: sim_cpp11_features.pl bslmf_conjunction.h
71# define COMPILING_BSLMF_CONJUNCTION_H
73# undef COMPILING_BSLMF_CONJUNCTION_H
74#else
75
76namespace bsl {
77
78#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
79
80using std::conjunction;
81using std::conjunction_v;
82
83#else
84
85 // ==================
86 // struct conjunction
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 conjunction : true_type {
99};
100#else
101template <>
103};
104#endif
105
106// 1 arg specialization
107template <class B1>
108struct conjunction<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 conjunction<B1, B2, Bn...> :
115 conditional<bool(B1::value), conjunction<B2, Bn...>, B1>::type {
116};
117#endif
118
119#ifdef BSLS_COMPILERFEATURES_SUPPORT_VARIABLE_TEMPLATES
120template <class... B>
122constexpr bool conjunction_v = conjunction<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_conjunction.h:102
Definition bslmf_conjunction.h:92