BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bslfmt_format_arg_cpp03.h
Go to the documentation of this file.
1/// @file bslfmt_format_arg_cpp03.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bslfmt_format_arg_cpp03.h -*-C++-*-
8
9// Automatically generated file. **DO NOT EDIT**
10
11#ifndef INCLUDED_BSLFMT_FORMAT_ARG_CPP03
12#define INCLUDED_BSLFMT_FORMAT_ARG_CPP03
13
14/// @defgroup bslfmt_format_arg_cpp03 bslfmt_format_arg_cpp03
15/// @brief Provide C++03 implementation for bslfmt_format_arg.h
16/// @addtogroup bsl
17/// @{
18/// @addtogroup bslfmt
19/// @{
20/// @addtogroup bslfmt_format_arg_cpp03
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bslfmt_format_arg_cpp03-purpose"> Purpose</a>
25/// * <a href="#bslfmt_format_arg_cpp03-classes"> Classes </a>
26/// * <a href="#bslfmt_format_arg_cpp03-description"> Description </a>
27///
28/// # Purpose {#bslfmt_format_arg_cpp03-purpose}
29/// Provide C++03 implementation for bslfmt_format_arg.h
30///
31/// # Classes {#bslfmt_format_arg_cpp03-classes}
32/// See bslfmt_format_arg.h for list of classes
33///
34/// @see bslfmt_format_arg
35///
36/// # Description {#bslfmt_format_arg_cpp03-description}
37/// This component is the C++03 translation of a C++11 component,
38/// generated by the 'sim_cpp11_features.pl' program. If the original header
39/// contains any specially delimited regions of C++11 code, then this generated
40/// file contains the C++03 equivalent, i.e., with variadic templates expanded
41/// and rvalue-references replaced by 'bslmf::MovableRef' objects. The header
42/// code in this file is designed to be '#include'd into the original header
43/// when compiling with a C++03 compiler. If there are no specially delimited
44/// regions of C++11 code, then this header contains no code and is not
45/// '#include'd in the original header.
46///
47/// Generated on Wed Apr 2 17:20:16 2025
48/// Command line: sim_cpp11_features.pl bslfmt_format_arg.h
49/// @}
50/** @} */
51/** @} */
52
53/** @addtogroup bsl
54 * @{
55 */
56/** @addtogroup bslfmt
57 * @{
58 */
59/** @addtogroup bslfmt_format_arg_cpp03
60 * @{
61 */
62
63#ifdef COMPILING_BSLFMT_FORMAT_ARG_H
64
65
66namespace bslfmt {
67
68// FORWARD DECLARATIONS
69
70template <class t_CHAR>
71class basic_format_parse_context;
72
73template <class t_OUT, class t_CHAR>
74class basic_format_context;
75
76template <class t_CONTEXT>
77class basic_format_arg;
78
79template <class t_VALUE>
80class Format_ContextOutputIteratorRef;
81
82// TYPEDEFS
83
84typedef basic_format_context<Format_ContextOutputIteratorRef<char>, char>
86
87typedef basic_format_context<Format_ContextOutputIteratorRef<wchar_t>, wchar_t>
89
90 // ======================
91 // class basic_format_arg
92 // ======================
93
94/// This class provides an STL-compliant @ref basic_format_arg which holds (by
95/// value for scalar and pointer types, by reference for user-defined types).
96/// These types should not be constructed directly by the user.
97template <class t_OUT, class t_CHAR>
98class basic_format_arg<basic_format_context<t_OUT, t_CHAR> > {
99 public:
100 // TYPES
101
102 /// This class provides a type-erased wrapper which holds a pointer to a
103 /// user-defined type and permits its formatting using the appropriate
104 /// bsl::formatter type.
105 ///
106 /// See @ref bslfmt_format_arg_cpp03
107 class handle {
108 private:
109 // DATA
110 const void *d_value_p;
111 // pointer to the referenced value
112
113 void (*d_format_impl_p)(basic_format_parse_context<t_CHAR>&,
114 basic_format_context<t_OUT, t_CHAR>&,
115 const void *);
116 // pointer to a format_impl instance
117
118 // FRIENDS
119 friend class basic_format_arg<basic_format_context<t_OUT, t_CHAR> >;
120
121 // PRIVATE CLASS METHODS
122
123 /// Format the specified `value` using a `bsl::formatter` instance for
124 /// the specified template parameter `t_TYPE`. The constructed
125 /// formatter will parse the specification in the specified `pc`
126 /// context and write the output to the specified `fc` context.
127 template <class t_TYPE>
128 static void format_impl(basic_format_parse_context<t_CHAR>& pc,
129 basic_format_context<t_OUT, t_CHAR>& fc,
130 const void *value);
131
132 // PRIVATE CREATORS
133
134 /// Create a `handle` referencing the specified `value` and initialize
135 /// the contained formatting function to an instance of @ref format_impl
136 /// for the template parameter `t_TYPE`.
137 template <class t_TYPE>
138 explicit handle(const t_TYPE& value) BSLS_KEYWORD_NOEXCEPT;
139
140 public:
141 // CREATORS
142#if !defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
143 /// Move-construct a `handle` from the specified `rhs`. This is
144 /// required to support use within a bsl::variant on C++03, but must
145 /// *not* be specified for C++11 and later as it will result in the
146 /// implicit deletion of other defaulted special member functions.
148#endif // !defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
149
150 // ACCESSORS
151
152 /// Format the contained value using a formatter for the template
153 /// parameter `t_TYPE` used in the construction of this object. The
154 /// constructed formatter will parse the specification in the specified
155 /// `pc` context and write the output to the specified `fc` context.
156 void format(basic_format_parse_context<t_CHAR>& pc,
157 basic_format_context<t_OUT, t_CHAR>& fc) const;
158 };
159
160 typedef typename BloombergLP::bsls::UnspecifiedBool<basic_format_arg>
161 UnspecifiedBoolType;
162 typedef typename UnspecifiedBoolType::BoolType BoolType;
163
164 private:
165 // NOT IMPLEMENTED
166 bool operator==(const basic_format_arg&) const BSLS_KEYWORD_DELETED;
167
168 // PRIVATE TYPES
169 typedef t_CHAR char_type;
170
172 bool,
173 char_type,
174 int,
175 unsigned,
176 long long,
177 unsigned long long,
178 float,
179 double,
180 long double,
181 const char_type *,
183 const void *,
184 handle>
185 variant_type;
186
187 // DATA
188 variant_type d_value; // the contained value or a reference thereto
189
190 // FRIENDS
191 friend class Format_ArgUtil;
192
193 // PRIVATE CREATORS
194
195 /// Create a @ref basic_format_arg from the specified `value`, which is then
196 /// held by value.
197 explicit basic_format_arg(bool value) BSLS_KEYWORD_NOEXCEPT;
198
199 /// Create a @ref basic_format_arg from the specified `value`, which is then
200 /// held by value.
201 explicit basic_format_arg(char_type value) BSLS_KEYWORD_NOEXCEPT;
202
203 /// Create a @ref basic_format_arg from the specified `value` widened from
204 /// type `char` to type `wchar_t`, which is then held by value. This
205 /// constructor only participates in overload resolution if `value` is of
206 /// type `char` and `t_CHAR` is of type `wchar_t`.
207 template <class t_TYPE>
208 explicit basic_format_arg(
209 t_TYPE value,
212 int>::type = 0) BSLS_KEYWORD_NOEXCEPT;
213
214 /// Create a @ref basic_format_arg from the specified `value`, which is then
215 /// held by value. This constructor only participates in overload
216 /// resolution if `value` is an signed integer type that can be held within
217 /// a `long long` or an unsigned integer type that can be held within an
218 /// `unsigned long long`.
219 template <class t_TYPE>
220 explicit basic_format_arg(
221 t_TYPE value,
222 typename bsl::enable_if<bsl::is_integral<t_TYPE>::value &&
223 !bsl::is_same<t_TYPE, char>::value &&
224 !bsl::is_same<t_TYPE, wchar_t>::value &&
225 (sizeof(t_TYPE) <= sizeof(long long)),
226 int>::type = 0) BSLS_KEYWORD_NOEXCEPT;
227
228 /// Create a @ref basic_format_arg from the specified `value`, which is then
229 /// held by reference in a `basic_format_arg::handle`. This constructor
230 /// only participates in overload resolution if `value` is not an integer
231 /// or if `value` is a signed integer type that can not be held within a
232 /// `long long` or an unsigned integer type that can not be held within an
233 /// `unsigned long long`. Participation in overload resolution is also
234 /// disabled if `value` is of type `long double`.
235 template <class t_TYPE>
236 explicit basic_format_arg(
237 const t_TYPE& value,
238 typename bsl::enable_if<(!bsl::is_integral<t_TYPE>::value &&
239 !bsl::is_same<t_TYPE, long double>::value) ||
240 (sizeof(t_TYPE) > sizeof(long long)),
241 int>::type = 0) BSLS_KEYWORD_NOEXCEPT;
242
243 /// Create a @ref basic_format_arg from the specified `value`, which is then
244 /// held by value.
245 explicit basic_format_arg(float value) BSLS_KEYWORD_NOEXCEPT;
246
247 /// Create a @ref basic_format_arg from the specified `value`, which is then
248 /// held by value.
249 explicit basic_format_arg(double value) BSLS_KEYWORD_NOEXCEPT;
250
251 /// Terminate by calling BSLMF_ASSERT. This constructor only participates
252 /// in overload resolution if `value` is of the currently unsupported type
253 /// `long double`. Note: this is required to use a template parameter to
254 /// ensure that this function is only instantiated when an attempt is made
255 /// to use it.
256 template <class t_TYPE>
257 explicit basic_format_arg(
258 t_TYPE value,
259 typename bsl::enable_if<bsl::is_same<t_TYPE, long double>::value,
260 int>::type = 0) BSLS_KEYWORD_NOEXCEPT;
261
262 /// Create a @ref basic_format_arg from the specified `value`, which is then
263 /// held by value.
264 template <class t_TRAITS>
265 explicit basic_format_arg(
266 bsl::basic_string_view<char_type, t_TRAITS> value) BSLS_KEYWORD_NOEXCEPT;
267
268#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
269#ifndef BSLSTL_STRING_VIEW_IS_ALIASED
270 /// Create a @ref basic_format_arg from the specified `value`, which is then
271 /// held by value.
272 template <class t_TRAITS>
273 explicit basic_format_arg(
274 std::basic_string_view<char_type, t_TRAITS> value) BSLS_KEYWORD_NOEXCEPT;
275#endif
276#endif
277
278 /// Create a @ref basic_format_arg holding (by value) a @ref string_view
279 /// constructed from the specified `value`.
280 template <class t_TRAITS, class t_ALLOC>
281 explicit basic_format_arg(bsl::basic_string<char_type, t_TRAITS, t_ALLOC>&
283
284 /// Create a @ref basic_format_arg holding (by value) a @ref string_view
285 /// constructed from the specified `value`.
286 template <class t_TRAITS, class t_ALLOC>
287 explicit basic_format_arg(
290
291 /// Create a @ref basic_format_arg holding (by value) a @ref string_view
292 /// constructed from the specified `value`.
293 template <class t_TRAITS, class t_ALLOC>
294 explicit basic_format_arg(std::basic_string<char_type, t_TRAITS, t_ALLOC>&
296
297 /// Create a @ref basic_format_arg holding (by value) a @ref string_view
298 /// constructed from the specified `value`.
299 template <class t_TRAITS, class t_ALLOC>
300 explicit basic_format_arg(
301 const std::basic_string<char_type, t_TRAITS, t_ALLOC>& value)
303
304 /// Create a @ref basic_format_arg from the specified `value`, which is then
305 /// held by value.
306 explicit basic_format_arg(char_type *value) BSLS_KEYWORD_NOEXCEPT;
307
308 /// Create a @ref basic_format_arg from the specified `value`, which is then
309 /// held by value.
310 explicit basic_format_arg(const char_type *value) BSLS_KEYWORD_NOEXCEPT;
311
312 /// Create a @ref basic_format_arg from the specified `value`, which is then
313 /// held by value.
314 explicit basic_format_arg(void *value) BSLS_KEYWORD_NOEXCEPT;
315
316 /// Create a @ref basic_format_arg from the specified `value`, which is then
317 /// held by value.
318 explicit basic_format_arg(const void *value) BSLS_KEYWORD_NOEXCEPT;
319
320 /// Create a @ref basic_format_arg which holds
321 /// `static_cast<const void *>(nullptr)`.
322 explicit basic_format_arg(bsl::nullptr_t) BSLS_KEYWORD_NOEXCEPT;
323
324 public:
325 // CREATORS
326
327 /// Create a @ref basic_format_arg which holds a `bsl::monostate`.
328 basic_format_arg() BSLS_KEYWORD_NOEXCEPT;
329
330#if !defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
331 /// Move-construct a @ref basic_format_arg from the specified `rhs`. This is
332 /// required to support use on C++03, but must *not* be specified for C++11
333 /// and later as it will result in the implicit deletion of other defaulted
334 /// special member functions.
335 basic_format_arg(
337#endif // !defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
338
339 // ACCESSORS
340
341 /// Return whether this object holds a value.
342 operator BoolType() const BSLS_KEYWORD_NOEXCEPT;
343
344 // MANIPULATORS
345
346#if !defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
347 /// Move-assign a @ref basic_format_arg from the specified `rhs`. This is
348 /// required to support use on C++03, but must *not* be specified for C++11
349 /// and later as it will result in the implicit deletion of other defaulted
350 /// special member functions.
351 basic_format_arg &operator=(
353#endif // !defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
354
355#if defined(BSLS_LIBRARYFEATURES_HAS_CPP14_BASELINE_LIBRARY) && \
356 defined(BSLS_LIBRARYFEATURES_HAS_CPP14_INTEGER_SEQUENCE)
357 // This check is a proxy for BSL_VARIANT_FULL_IMPLEMENTATION which is unset
358 // at the end of bslstl_variant.h
359
360 /// Invoke the specified `visitor` functor on the value contained by this
361 /// object, providing that functor non-modifiable access to that value.
362 /// `visitor` must be a `variant`-style functor that is able to visit all
363 /// supported types listed in the {DESCRIPTION}.
364 template <class t_VISITOR>
365 decltype(auto) visit(t_VISITOR&& visitor);
366#else
367 /// Invoke the specified `visitor` functor on the value contained by this
368 /// object, providing that functor non-modifiable access to that value.
369 /// `visitor` must be a `variant`-style functor that is able to visit all
370 /// supported types listed in the {DESCRIPTION}.
371 template <class t_VISITOR>
373 t_VISITOR& visitor);
374#endif
375
376 // HIDDEN FRIENDS
377
378 /// Exchange the values of the specified `lhs` and `rhs`.
379 friend void swap(basic_format_arg& lhs, basic_format_arg& rhs)
380 {
381 lhs.d_value.swap(rhs.d_value);
382 }
383};
384
385 // ====================
386 // class Format_ArgUtil
387 // ====================
388
389#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
390// {{{ BEGIN GENERATED CODE
391// Command line: sim_cpp11_features.pl bslfmt_format_arg.h
392#ifndef BSLFMT_FORMAT_ARG_VARIADIC_LIMIT
393#define BSLFMT_FORMAT_ARG_VARIADIC_LIMIT 10
394#endif
395#ifndef BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A
396#define BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A BSLFMT_FORMAT_ARG_VARIADIC_LIMIT
397#endif
398class Format_ArgUtil {
399 public:
400
401#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 0
402 template <class t_CONTEXT>
403 static void makeFormatArgArray(
404 bsl::array<basic_format_arg<t_CONTEXT>, 0u> *out);
405#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 0
406
407#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 1
408 template <class t_CONTEXT, class t_FMTARGS_01>
409 static void makeFormatArgArray(
410 bsl::array<basic_format_arg<t_CONTEXT>, 1u> *out,
411 t_FMTARGS_01& fmt_args_01);
412#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 1
413
414#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 2
415 template <class t_CONTEXT, class t_FMTARGS_01,
416 class t_FMTARGS_02>
417 static void makeFormatArgArray(
418 bsl::array<basic_format_arg<t_CONTEXT>, 2u> *out,
419 t_FMTARGS_01& fmt_args_01,
420 t_FMTARGS_02& fmt_args_02);
421#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 2
422
423#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 3
424 template <class t_CONTEXT, class t_FMTARGS_01,
425 class t_FMTARGS_02,
426 class t_FMTARGS_03>
427 static void makeFormatArgArray(
428 bsl::array<basic_format_arg<t_CONTEXT>, 3u> *out,
429 t_FMTARGS_01& fmt_args_01,
430 t_FMTARGS_02& fmt_args_02,
431 t_FMTARGS_03& fmt_args_03);
432#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 3
433
434#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 4
435 template <class t_CONTEXT, class t_FMTARGS_01,
436 class t_FMTARGS_02,
437 class t_FMTARGS_03,
438 class t_FMTARGS_04>
439 static void makeFormatArgArray(
440 bsl::array<basic_format_arg<t_CONTEXT>, 4u> *out,
441 t_FMTARGS_01& fmt_args_01,
442 t_FMTARGS_02& fmt_args_02,
443 t_FMTARGS_03& fmt_args_03,
444 t_FMTARGS_04& fmt_args_04);
445#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 4
446
447#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 5
448 template <class t_CONTEXT, class t_FMTARGS_01,
449 class t_FMTARGS_02,
450 class t_FMTARGS_03,
451 class t_FMTARGS_04,
452 class t_FMTARGS_05>
453 static void makeFormatArgArray(
454 bsl::array<basic_format_arg<t_CONTEXT>, 5u> *out,
455 t_FMTARGS_01& fmt_args_01,
456 t_FMTARGS_02& fmt_args_02,
457 t_FMTARGS_03& fmt_args_03,
458 t_FMTARGS_04& fmt_args_04,
459 t_FMTARGS_05& fmt_args_05);
460#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 5
461
462#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 6
463 template <class t_CONTEXT, class t_FMTARGS_01,
464 class t_FMTARGS_02,
465 class t_FMTARGS_03,
466 class t_FMTARGS_04,
467 class t_FMTARGS_05,
468 class t_FMTARGS_06>
469 static void makeFormatArgArray(
470 bsl::array<basic_format_arg<t_CONTEXT>, 6u> *out,
471 t_FMTARGS_01& fmt_args_01,
472 t_FMTARGS_02& fmt_args_02,
473 t_FMTARGS_03& fmt_args_03,
474 t_FMTARGS_04& fmt_args_04,
475 t_FMTARGS_05& fmt_args_05,
476 t_FMTARGS_06& fmt_args_06);
477#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 6
478
479#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 7
480 template <class t_CONTEXT, class t_FMTARGS_01,
481 class t_FMTARGS_02,
482 class t_FMTARGS_03,
483 class t_FMTARGS_04,
484 class t_FMTARGS_05,
485 class t_FMTARGS_06,
486 class t_FMTARGS_07>
487 static void makeFormatArgArray(
488 bsl::array<basic_format_arg<t_CONTEXT>, 7u> *out,
489 t_FMTARGS_01& fmt_args_01,
490 t_FMTARGS_02& fmt_args_02,
491 t_FMTARGS_03& fmt_args_03,
492 t_FMTARGS_04& fmt_args_04,
493 t_FMTARGS_05& fmt_args_05,
494 t_FMTARGS_06& fmt_args_06,
495 t_FMTARGS_07& fmt_args_07);
496#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 7
497
498#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 8
499 template <class t_CONTEXT, class t_FMTARGS_01,
500 class t_FMTARGS_02,
501 class t_FMTARGS_03,
502 class t_FMTARGS_04,
503 class t_FMTARGS_05,
504 class t_FMTARGS_06,
505 class t_FMTARGS_07,
506 class t_FMTARGS_08>
507 static void makeFormatArgArray(
508 bsl::array<basic_format_arg<t_CONTEXT>, 8u> *out,
509 t_FMTARGS_01& fmt_args_01,
510 t_FMTARGS_02& fmt_args_02,
511 t_FMTARGS_03& fmt_args_03,
512 t_FMTARGS_04& fmt_args_04,
513 t_FMTARGS_05& fmt_args_05,
514 t_FMTARGS_06& fmt_args_06,
515 t_FMTARGS_07& fmt_args_07,
516 t_FMTARGS_08& fmt_args_08);
517#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 8
518
519#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 9
520 template <class t_CONTEXT, class t_FMTARGS_01,
521 class t_FMTARGS_02,
522 class t_FMTARGS_03,
523 class t_FMTARGS_04,
524 class t_FMTARGS_05,
525 class t_FMTARGS_06,
526 class t_FMTARGS_07,
527 class t_FMTARGS_08,
528 class t_FMTARGS_09>
529 static void makeFormatArgArray(
530 bsl::array<basic_format_arg<t_CONTEXT>, 9u> *out,
531 t_FMTARGS_01& fmt_args_01,
532 t_FMTARGS_02& fmt_args_02,
533 t_FMTARGS_03& fmt_args_03,
534 t_FMTARGS_04& fmt_args_04,
535 t_FMTARGS_05& fmt_args_05,
536 t_FMTARGS_06& fmt_args_06,
537 t_FMTARGS_07& fmt_args_07,
538 t_FMTARGS_08& fmt_args_08,
539 t_FMTARGS_09& fmt_args_09);
540#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 9
541
542#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 10
543 template <class t_CONTEXT, class t_FMTARGS_01,
544 class t_FMTARGS_02,
545 class t_FMTARGS_03,
546 class t_FMTARGS_04,
547 class t_FMTARGS_05,
548 class t_FMTARGS_06,
549 class t_FMTARGS_07,
550 class t_FMTARGS_08,
551 class t_FMTARGS_09,
552 class t_FMTARGS_10>
553 static void makeFormatArgArray(
554 bsl::array<basic_format_arg<t_CONTEXT>, 10u> *out,
555 t_FMTARGS_01& fmt_args_01,
556 t_FMTARGS_02& fmt_args_02,
557 t_FMTARGS_03& fmt_args_03,
558 t_FMTARGS_04& fmt_args_04,
559 t_FMTARGS_05& fmt_args_05,
560 t_FMTARGS_06& fmt_args_06,
561 t_FMTARGS_07& fmt_args_07,
562 t_FMTARGS_08& fmt_args_08,
563 t_FMTARGS_09& fmt_args_09,
564 t_FMTARGS_10& fmt_args_10);
565#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_A >= 10
566
567};
568#else
569// The generated code below is a workaround for the absence of perfect
570// forwarding in some compilers.
571class Format_ArgUtil {
572 public:
573
574 template <class t_CONTEXT, class... t_FMTARGS>
575 static void makeFormatArgArray(
576 bsl::array<basic_format_arg<t_CONTEXT>, sizeof...(t_FMTARGS)> *out,
577 t_FMTARGS&... fmt_args);
578};
579
580// }}} END GENERATED CODE
581#endif
582
583// FREE FUNCTIONS
584
585#if defined(BSLS_LIBRARYFEATURES_HAS_CPP14_BASELINE_LIBRARY) && \
586 defined(BSLS_LIBRARYFEATURES_HAS_CPP14_INTEGER_SEQUENCE)
587 // This check is a proxy for BSL_VARIANT_FULL_IMPLEMENTATION which is unset
588 // at the end of bslstl_variant.h
589
590/// Invoke the specified `visitor` functor on the value contained by the
591/// specified `arg`, providing that functor non-modifiable access to that
592/// value. `visitor` must be a `variant`-style functor that is able to visit
593/// all supported types listed in the {DESCRIPTION}.
594template <class t_VISITOR, class t_CONTEXT>
595decltype(auto) visit_format_arg(t_VISITOR&& visitor,
596 basic_format_arg<t_CONTEXT> arg);
597#else
598
599/// Invoke the specified `visitor` functor on the value contained by the
600/// specified `arg`, providing that functor non-modifiable access to that
601/// value. `visitor` must be a `variant`-style functor that is able to visit
602/// all supported types listed in the {DESCRIPTION}.
603template <class t_VISITOR, class t_CONTEXT>
605visit_format_arg(t_VISITOR& visitor, basic_format_arg<t_CONTEXT> arg);
606#endif
607
608// ============================================================================
609// INLINE DEFINITIONS
610// ============================================================================
611
612 // ----------------------
613 // class basic_format_arg
614 // ----------------------
615
616// PRIVATE CLASS METHODS
617template <class t_OUT, class t_CHAR>
618template <class t_TYPE>
619inline
620void
621basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::handle::format_impl(
622 basic_format_parse_context<t_CHAR>& pc,
623 basic_format_context<t_OUT, t_CHAR>& fc,
624 const void *value)
625{
627 pc.advance_to(f.parse(pc));
628 fc.advance_to(f.format(*static_cast<const t_TYPE *>(value), fc));
629}
630
631// PRIVATE CREATORS
632template <class t_OUT, class t_CHAR>
633template <class t_TYPE>
634inline
635basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::handle::handle(
636 const t_TYPE& value) BSLS_KEYWORD_NOEXCEPT
637: d_value_p(BSLS_UTIL_ADDRESSOF(value))
638, d_format_impl_p(format_impl<t_TYPE>)
639{
640}
641
642// CREATORS
643#if !defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
644template <class t_OUT, class t_CHAR>
645inline
646basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::handle::handle(
648{
649 d_value_p = bslmf::MovableRefUtil::move(
650 bslmf::MovableRefUtil::access(rhs).d_value_p);
651 d_format_impl_p = bslmf::MovableRefUtil::move(
652 bslmf::MovableRefUtil::access(rhs).d_format_impl_p);
653}
654#endif // !defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
655
656// ACCESSORS
657template <class t_OUT, class t_CHAR>
658inline
659void basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::handle::format(
660 basic_format_parse_context<t_CHAR>& pc,
661 basic_format_context<t_OUT, t_CHAR>& fc) const
662{
663 d_format_impl_p(pc, fc, d_value_p);
664}
665
666 // ----------------------
667 // class basic_format_arg
668 // ----------------------
669
670// MANIPULATORS
671
672#if defined(BSLS_LIBRARYFEATURES_HAS_CPP14_BASELINE_LIBRARY) && \
673 defined(BSLS_LIBRARYFEATURES_HAS_CPP14_INTEGER_SEQUENCE)
674 // This check is a proxy for BSL_VARIANT_FULL_IMPLEMENTATION which is unset
675 // at the end of bslstl_variant.h
676template <class t_OUT, class t_CHAR>
677template <class t_VISITOR>
678inline
679decltype(auto) basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::visit(
680 t_VISITOR&& v)
681{
682 auto thisCopy(*this);
683 return bsl::visit(std::forward<t_VISITOR>(v), thisCopy.d_value);
684}
685#else
686template <class t_OUT, class t_CHAR>
687template <class t_VISITOR>
688inline
690basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::visit(t_VISITOR& v)
691{
692 basic_format_arg thisCopy(*this);
693 return bsl::visit(v, thisCopy.d_value);
694}
695#endif
696
697// PRIVATE CREATORS
698template <class t_OUT, class t_CHAR>
699inline
700basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg(
701 bool value) BSLS_KEYWORD_NOEXCEPT
702: d_value(value)
703{
704}
705
706template <class t_OUT, class t_CHAR>
707inline
708basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg(
709 char_type value) BSLS_KEYWORD_NOEXCEPT
710: d_value(value)
711{
712}
713
714template <class t_OUT, class t_CHAR>
715template <class t_TYPE>
716inline
717basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg(
718 t_TYPE value,
721 int>::type) BSLS_KEYWORD_NOEXCEPT
722{
723 static const std::ctype<wchar_t>& ct =
724 std::use_facet<std::ctype<wchar_t> >(std::locale::classic());
725 d_value = ct.widen(value);
726}
727
728template <class t_OUT, class t_CHAR>
729template <class t_TYPE>
730inline
731basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg(
732 t_TYPE value,
736 (sizeof(t_TYPE) <= sizeof(long long)),
737 int>::type) BSLS_KEYWORD_NOEXCEPT
738{
739 if (static_cast<t_TYPE>(-1) < static_cast<t_TYPE>(0)) {
740 // `t_TYPE` is signed
741 if (sizeof(t_TYPE) <= sizeof(int)) {
742 d_value.template emplace<int>(static_cast<int>(value));
743 }
744 else {
745 d_value.template emplace<long long>(value);
746 }
747 }
748 else {
749 // `t_TYPE` is unsigned
750 if (sizeof(t_TYPE) <= sizeof(int)) {
751 d_value.template emplace<unsigned int>(
752 static_cast<unsigned int>(value));
753 }
754 else {
755 d_value.template emplace<unsigned long long>(value);
756 }
757 }
758}
759
760template <class t_OUT, class t_CHAR>
761template <class t_TYPE>
762inline
763basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg(
764 const t_TYPE& value,
767 (sizeof(t_TYPE) > sizeof(long long)),
768 int>::type) BSLS_KEYWORD_NOEXCEPT
769: d_value(handle(value))
770{
771}
772
773template <class t_OUT, class t_CHAR>
774inline
775basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg(
776 float value) BSLS_KEYWORD_NOEXCEPT
777: d_value(value)
778{
779}
780
781template <class t_OUT, class t_CHAR>
782inline
783basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg(
784 double value) BSLS_KEYWORD_NOEXCEPT
785: d_value(value)
786{
787}
788
789template <class t_OUT, class t_CHAR>
790template <class t_TYPE>
791inline
792basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg(
793 t_TYPE value,
795 int>::type) BSLS_KEYWORD_NOEXCEPT
796: d_value(static_cast<long double>(value))
797{
798#ifdef BSLS_COMPILERFEATURES_SUPPORT_STATIC_ASSERT
800 "long double not supported by bsl::format");
801#else
803#endif
804}
805
806template <class t_OUT, class t_CHAR>
807template <class t_TRAITS>
808inline
809basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg(
811: d_value(static_cast<bsl::basic_string_view<char_type> >(value))
812{
813}
814
815#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
816#ifndef BSLSTL_STRING_VIEW_IS_ALIASED
817template <class t_OUT, class t_CHAR>
818template <class t_TRAITS>
819inline
820basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg(
821 std::basic_string_view<char_type, t_TRAITS> value) BSLS_KEYWORD_NOEXCEPT
822: d_value(static_cast<bsl::basic_string_view<char_type> >(value))
823{
824}
825#endif
826#endif
827
828template <class t_OUT, class t_CHAR>
829template <class t_TRAITS, class t_ALLOC>
830inline
831basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg(
833: d_value(static_cast<bsl::basic_string_view<char_type> >(value))
834{
835}
836
837template <class t_OUT, class t_CHAR>
838template <class t_TRAITS, class t_ALLOC>
839inline
840basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg(
843: d_value(static_cast<bsl::basic_string_view<char_type> >(value))
844{
845}
846
847template <class t_OUT, class t_CHAR>
848template <class t_TRAITS, class t_ALLOC>
849inline
850basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg(
851 std::basic_string<char_type, t_TRAITS, t_ALLOC>& value) BSLS_KEYWORD_NOEXCEPT
852: d_value(static_cast<bsl::basic_string_view<char_type> >(value))
853{
854}
855
856template <class t_OUT, class t_CHAR>
857template <class t_TRAITS, class t_ALLOC>
858inline
859basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg(
860 const std::basic_string<char_type, t_TRAITS, t_ALLOC>& value)
862: d_value(static_cast<bsl::basic_string_view<char_type> >(value))
863{
864}
865
866template <class t_OUT, class t_CHAR>
867inline
868basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg(
869 char_type *value) BSLS_KEYWORD_NOEXCEPT
870: d_value(static_cast<const char_type *>(value))
871{
872}
873
874template <class t_OUT, class t_CHAR>
875inline
876basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg(
877 const char_type *value) BSLS_KEYWORD_NOEXCEPT
878: d_value(value)
879{
880}
881
882template <class t_OUT, class t_CHAR>
883inline
884basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg(
885 void *value) BSLS_KEYWORD_NOEXCEPT
886: d_value(static_cast<const void *>(value))
887{
888}
889
890template <class t_OUT, class t_CHAR>
891inline
892basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg(
893 const void *value) BSLS_KEYWORD_NOEXCEPT
894: d_value(value)
895{
896}
897
898template <class t_OUT, class t_CHAR>
899inline
900basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg(
902
903#if defined(BSLS_COMPILERFEATURES_SUPPORT_NULLPTR)
904: d_value(static_cast<const void *>(nullptr))
905#else
906: d_value(static_cast<const void *>(0))
907#endif
908{
909}
910
911// CREATORS
912template <class t_OUT, class t_CHAR>
913inline
914basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg()
916{
917}
918
919#if !defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
920template <class t_OUT, class t_CHAR>
921inline
922basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::basic_format_arg(
924{
926 bslmf::MovableRefUtil::access(rhs).d_value);
927}
928#endif // !defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
929
930// ACCESSORS
931template <class t_OUT, class t_CHAR>
932inline
933basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::operator BoolType()
935{
936 return UnspecifiedBoolType::makeValue(
937 !bsl::holds_alternative<bsl::monostate>(d_value));
938}
939
940// MANIPULATORS
941#if !defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
942template <class t_OUT, class t_CHAR>
943inline
944basic_format_arg<basic_format_context<t_OUT, t_CHAR> > &
945basic_format_arg<basic_format_context<t_OUT, t_CHAR> >::operator=(
947{
949 bslmf::MovableRefUtil::access(rhs).d_value);
950 return *this;
951}
952#endif // !defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
953
954 // --------------------
955 // class Format_ArgUtil
956 // --------------------
957
958// CLASS METHODS
959
960#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
961// {{{ BEGIN GENERATED CODE
962// Command line: sim_cpp11_features.pl bslfmt_format_arg.h
963#ifndef BSLFMT_FORMAT_ARG_VARIADIC_LIMIT
964#define BSLFMT_FORMAT_ARG_VARIADIC_LIMIT 10
965#endif
966#ifndef BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B
967#define BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B BSLFMT_FORMAT_ARG_VARIADIC_LIMIT
968#endif
969#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 0
970template <class t_CONTEXT>
971inline
973 bsl::array<basic_format_arg<t_CONTEXT>, 0u> *out)
974{
975#ifndef BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS
977 {}};
978 *out = bslmf::MovableRefUtil::move(tmp);
979#else
980 *out = { {} };
981#endif
982}
983#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 0
984
985#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 1
986template <class t_CONTEXT, class t_FMTARGS_01>
987inline
989 bsl::array<basic_format_arg<t_CONTEXT>, 1u> *out,
990 t_FMTARGS_01& fmt_args_01)
991{
992#ifndef BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS
994 {basic_format_arg<t_CONTEXT>(fmt_args_01)}};
995 *out = bslmf::MovableRefUtil::move(tmp);
996#else
997 *out = { {basic_format_arg<t_CONTEXT>(fmt_args_01)} };
998#endif
999}
1000#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 1
1001
1002#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 2
1003template <class t_CONTEXT, class t_FMTARGS_01,
1004 class t_FMTARGS_02>
1005inline
1007 bsl::array<basic_format_arg<t_CONTEXT>, 2u> *out,
1008 t_FMTARGS_01& fmt_args_01,
1009 t_FMTARGS_02& fmt_args_02)
1010{
1011#ifndef BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS
1013 {basic_format_arg<t_CONTEXT>(fmt_args_01),
1014 basic_format_arg<t_CONTEXT>(fmt_args_02)}};
1015 *out = bslmf::MovableRefUtil::move(tmp);
1016#else
1017 *out = { {basic_format_arg<t_CONTEXT>(fmt_args_01),
1018 basic_format_arg<t_CONTEXT>(fmt_args_02)} };
1019#endif
1020}
1021#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 2
1022
1023#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 3
1024template <class t_CONTEXT, class t_FMTARGS_01,
1025 class t_FMTARGS_02,
1026 class t_FMTARGS_03>
1027inline
1029 bsl::array<basic_format_arg<t_CONTEXT>, 3u> *out,
1030 t_FMTARGS_01& fmt_args_01,
1031 t_FMTARGS_02& fmt_args_02,
1032 t_FMTARGS_03& fmt_args_03)
1033{
1034#ifndef BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS
1036 {basic_format_arg<t_CONTEXT>(fmt_args_01),
1037 basic_format_arg<t_CONTEXT>(fmt_args_02),
1038 basic_format_arg<t_CONTEXT>(fmt_args_03)}};
1039 *out = bslmf::MovableRefUtil::move(tmp);
1040#else
1041 *out = { {basic_format_arg<t_CONTEXT>(fmt_args_01),
1042 basic_format_arg<t_CONTEXT>(fmt_args_02),
1043 basic_format_arg<t_CONTEXT>(fmt_args_03)} };
1044#endif
1045}
1046#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 3
1047
1048#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 4
1049template <class t_CONTEXT, class t_FMTARGS_01,
1050 class t_FMTARGS_02,
1051 class t_FMTARGS_03,
1052 class t_FMTARGS_04>
1053inline
1055 bsl::array<basic_format_arg<t_CONTEXT>, 4u> *out,
1056 t_FMTARGS_01& fmt_args_01,
1057 t_FMTARGS_02& fmt_args_02,
1058 t_FMTARGS_03& fmt_args_03,
1059 t_FMTARGS_04& fmt_args_04)
1060{
1061#ifndef BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS
1063 {basic_format_arg<t_CONTEXT>(fmt_args_01),
1064 basic_format_arg<t_CONTEXT>(fmt_args_02),
1065 basic_format_arg<t_CONTEXT>(fmt_args_03),
1066 basic_format_arg<t_CONTEXT>(fmt_args_04)}};
1067 *out = bslmf::MovableRefUtil::move(tmp);
1068#else
1069 *out = { {basic_format_arg<t_CONTEXT>(fmt_args_01),
1070 basic_format_arg<t_CONTEXT>(fmt_args_02),
1071 basic_format_arg<t_CONTEXT>(fmt_args_03),
1072 basic_format_arg<t_CONTEXT>(fmt_args_04)} };
1073#endif
1074}
1075#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 4
1076
1077#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 5
1078template <class t_CONTEXT, class t_FMTARGS_01,
1079 class t_FMTARGS_02,
1080 class t_FMTARGS_03,
1081 class t_FMTARGS_04,
1082 class t_FMTARGS_05>
1083inline
1085 bsl::array<basic_format_arg<t_CONTEXT>, 5u> *out,
1086 t_FMTARGS_01& fmt_args_01,
1087 t_FMTARGS_02& fmt_args_02,
1088 t_FMTARGS_03& fmt_args_03,
1089 t_FMTARGS_04& fmt_args_04,
1090 t_FMTARGS_05& fmt_args_05)
1091{
1092#ifndef BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS
1094 {basic_format_arg<t_CONTEXT>(fmt_args_01),
1095 basic_format_arg<t_CONTEXT>(fmt_args_02),
1096 basic_format_arg<t_CONTEXT>(fmt_args_03),
1097 basic_format_arg<t_CONTEXT>(fmt_args_04),
1098 basic_format_arg<t_CONTEXT>(fmt_args_05)}};
1099 *out = bslmf::MovableRefUtil::move(tmp);
1100#else
1101 *out = { {basic_format_arg<t_CONTEXT>(fmt_args_01),
1102 basic_format_arg<t_CONTEXT>(fmt_args_02),
1103 basic_format_arg<t_CONTEXT>(fmt_args_03),
1104 basic_format_arg<t_CONTEXT>(fmt_args_04),
1105 basic_format_arg<t_CONTEXT>(fmt_args_05)} };
1106#endif
1107}
1108#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 5
1109
1110#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 6
1111template <class t_CONTEXT, class t_FMTARGS_01,
1112 class t_FMTARGS_02,
1113 class t_FMTARGS_03,
1114 class t_FMTARGS_04,
1115 class t_FMTARGS_05,
1116 class t_FMTARGS_06>
1117inline
1119 bsl::array<basic_format_arg<t_CONTEXT>, 6u> *out,
1120 t_FMTARGS_01& fmt_args_01,
1121 t_FMTARGS_02& fmt_args_02,
1122 t_FMTARGS_03& fmt_args_03,
1123 t_FMTARGS_04& fmt_args_04,
1124 t_FMTARGS_05& fmt_args_05,
1125 t_FMTARGS_06& fmt_args_06)
1126{
1127#ifndef BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS
1129 {basic_format_arg<t_CONTEXT>(fmt_args_01),
1130 basic_format_arg<t_CONTEXT>(fmt_args_02),
1131 basic_format_arg<t_CONTEXT>(fmt_args_03),
1132 basic_format_arg<t_CONTEXT>(fmt_args_04),
1133 basic_format_arg<t_CONTEXT>(fmt_args_05),
1134 basic_format_arg<t_CONTEXT>(fmt_args_06)}};
1135 *out = bslmf::MovableRefUtil::move(tmp);
1136#else
1137 *out = { {basic_format_arg<t_CONTEXT>(fmt_args_01),
1138 basic_format_arg<t_CONTEXT>(fmt_args_02),
1139 basic_format_arg<t_CONTEXT>(fmt_args_03),
1140 basic_format_arg<t_CONTEXT>(fmt_args_04),
1141 basic_format_arg<t_CONTEXT>(fmt_args_05),
1142 basic_format_arg<t_CONTEXT>(fmt_args_06)} };
1143#endif
1144}
1145#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 6
1146
1147#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 7
1148template <class t_CONTEXT, class t_FMTARGS_01,
1149 class t_FMTARGS_02,
1150 class t_FMTARGS_03,
1151 class t_FMTARGS_04,
1152 class t_FMTARGS_05,
1153 class t_FMTARGS_06,
1154 class t_FMTARGS_07>
1155inline
1157 bsl::array<basic_format_arg<t_CONTEXT>, 7u> *out,
1158 t_FMTARGS_01& fmt_args_01,
1159 t_FMTARGS_02& fmt_args_02,
1160 t_FMTARGS_03& fmt_args_03,
1161 t_FMTARGS_04& fmt_args_04,
1162 t_FMTARGS_05& fmt_args_05,
1163 t_FMTARGS_06& fmt_args_06,
1164 t_FMTARGS_07& fmt_args_07)
1165{
1166#ifndef BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS
1168 {basic_format_arg<t_CONTEXT>(fmt_args_01),
1169 basic_format_arg<t_CONTEXT>(fmt_args_02),
1170 basic_format_arg<t_CONTEXT>(fmt_args_03),
1171 basic_format_arg<t_CONTEXT>(fmt_args_04),
1172 basic_format_arg<t_CONTEXT>(fmt_args_05),
1173 basic_format_arg<t_CONTEXT>(fmt_args_06),
1174 basic_format_arg<t_CONTEXT>(fmt_args_07)}};
1175 *out = bslmf::MovableRefUtil::move(tmp);
1176#else
1177 *out = { {basic_format_arg<t_CONTEXT>(fmt_args_01),
1178 basic_format_arg<t_CONTEXT>(fmt_args_02),
1179 basic_format_arg<t_CONTEXT>(fmt_args_03),
1180 basic_format_arg<t_CONTEXT>(fmt_args_04),
1181 basic_format_arg<t_CONTEXT>(fmt_args_05),
1182 basic_format_arg<t_CONTEXT>(fmt_args_06),
1183 basic_format_arg<t_CONTEXT>(fmt_args_07)} };
1184#endif
1185}
1186#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 7
1187
1188#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 8
1189template <class t_CONTEXT, class t_FMTARGS_01,
1190 class t_FMTARGS_02,
1191 class t_FMTARGS_03,
1192 class t_FMTARGS_04,
1193 class t_FMTARGS_05,
1194 class t_FMTARGS_06,
1195 class t_FMTARGS_07,
1196 class t_FMTARGS_08>
1197inline
1199 bsl::array<basic_format_arg<t_CONTEXT>, 8u> *out,
1200 t_FMTARGS_01& fmt_args_01,
1201 t_FMTARGS_02& fmt_args_02,
1202 t_FMTARGS_03& fmt_args_03,
1203 t_FMTARGS_04& fmt_args_04,
1204 t_FMTARGS_05& fmt_args_05,
1205 t_FMTARGS_06& fmt_args_06,
1206 t_FMTARGS_07& fmt_args_07,
1207 t_FMTARGS_08& fmt_args_08)
1208{
1209#ifndef BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS
1211 {basic_format_arg<t_CONTEXT>(fmt_args_01),
1212 basic_format_arg<t_CONTEXT>(fmt_args_02),
1213 basic_format_arg<t_CONTEXT>(fmt_args_03),
1214 basic_format_arg<t_CONTEXT>(fmt_args_04),
1215 basic_format_arg<t_CONTEXT>(fmt_args_05),
1216 basic_format_arg<t_CONTEXT>(fmt_args_06),
1217 basic_format_arg<t_CONTEXT>(fmt_args_07),
1218 basic_format_arg<t_CONTEXT>(fmt_args_08)}};
1219 *out = bslmf::MovableRefUtil::move(tmp);
1220#else
1221 *out = { {basic_format_arg<t_CONTEXT>(fmt_args_01),
1222 basic_format_arg<t_CONTEXT>(fmt_args_02),
1223 basic_format_arg<t_CONTEXT>(fmt_args_03),
1224 basic_format_arg<t_CONTEXT>(fmt_args_04),
1225 basic_format_arg<t_CONTEXT>(fmt_args_05),
1226 basic_format_arg<t_CONTEXT>(fmt_args_06),
1227 basic_format_arg<t_CONTEXT>(fmt_args_07),
1228 basic_format_arg<t_CONTEXT>(fmt_args_08)} };
1229#endif
1230}
1231#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 8
1232
1233#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 9
1234template <class t_CONTEXT, class t_FMTARGS_01,
1235 class t_FMTARGS_02,
1236 class t_FMTARGS_03,
1237 class t_FMTARGS_04,
1238 class t_FMTARGS_05,
1239 class t_FMTARGS_06,
1240 class t_FMTARGS_07,
1241 class t_FMTARGS_08,
1242 class t_FMTARGS_09>
1243inline
1245 bsl::array<basic_format_arg<t_CONTEXT>, 9u> *out,
1246 t_FMTARGS_01& fmt_args_01,
1247 t_FMTARGS_02& fmt_args_02,
1248 t_FMTARGS_03& fmt_args_03,
1249 t_FMTARGS_04& fmt_args_04,
1250 t_FMTARGS_05& fmt_args_05,
1251 t_FMTARGS_06& fmt_args_06,
1252 t_FMTARGS_07& fmt_args_07,
1253 t_FMTARGS_08& fmt_args_08,
1254 t_FMTARGS_09& fmt_args_09)
1255{
1256#ifndef BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS
1258 {basic_format_arg<t_CONTEXT>(fmt_args_01),
1259 basic_format_arg<t_CONTEXT>(fmt_args_02),
1260 basic_format_arg<t_CONTEXT>(fmt_args_03),
1261 basic_format_arg<t_CONTEXT>(fmt_args_04),
1262 basic_format_arg<t_CONTEXT>(fmt_args_05),
1263 basic_format_arg<t_CONTEXT>(fmt_args_06),
1264 basic_format_arg<t_CONTEXT>(fmt_args_07),
1265 basic_format_arg<t_CONTEXT>(fmt_args_08),
1266 basic_format_arg<t_CONTEXT>(fmt_args_09)}};
1267 *out = bslmf::MovableRefUtil::move(tmp);
1268#else
1269 *out = { {basic_format_arg<t_CONTEXT>(fmt_args_01),
1270 basic_format_arg<t_CONTEXT>(fmt_args_02),
1271 basic_format_arg<t_CONTEXT>(fmt_args_03),
1272 basic_format_arg<t_CONTEXT>(fmt_args_04),
1273 basic_format_arg<t_CONTEXT>(fmt_args_05),
1274 basic_format_arg<t_CONTEXT>(fmt_args_06),
1275 basic_format_arg<t_CONTEXT>(fmt_args_07),
1276 basic_format_arg<t_CONTEXT>(fmt_args_08),
1277 basic_format_arg<t_CONTEXT>(fmt_args_09)} };
1278#endif
1279}
1280#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 9
1281
1282#if BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 10
1283template <class t_CONTEXT, class t_FMTARGS_01,
1284 class t_FMTARGS_02,
1285 class t_FMTARGS_03,
1286 class t_FMTARGS_04,
1287 class t_FMTARGS_05,
1288 class t_FMTARGS_06,
1289 class t_FMTARGS_07,
1290 class t_FMTARGS_08,
1291 class t_FMTARGS_09,
1292 class t_FMTARGS_10>
1293inline
1295 bsl::array<basic_format_arg<t_CONTEXT>, 10u> *out,
1296 t_FMTARGS_01& fmt_args_01,
1297 t_FMTARGS_02& fmt_args_02,
1298 t_FMTARGS_03& fmt_args_03,
1299 t_FMTARGS_04& fmt_args_04,
1300 t_FMTARGS_05& fmt_args_05,
1301 t_FMTARGS_06& fmt_args_06,
1302 t_FMTARGS_07& fmt_args_07,
1303 t_FMTARGS_08& fmt_args_08,
1304 t_FMTARGS_09& fmt_args_09,
1305 t_FMTARGS_10& fmt_args_10)
1306{
1307#ifndef BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS
1309 {basic_format_arg<t_CONTEXT>(fmt_args_01),
1310 basic_format_arg<t_CONTEXT>(fmt_args_02),
1311 basic_format_arg<t_CONTEXT>(fmt_args_03),
1312 basic_format_arg<t_CONTEXT>(fmt_args_04),
1313 basic_format_arg<t_CONTEXT>(fmt_args_05),
1314 basic_format_arg<t_CONTEXT>(fmt_args_06),
1315 basic_format_arg<t_CONTEXT>(fmt_args_07),
1316 basic_format_arg<t_CONTEXT>(fmt_args_08),
1317 basic_format_arg<t_CONTEXT>(fmt_args_09),
1318 basic_format_arg<t_CONTEXT>(fmt_args_10)}};
1319 *out = bslmf::MovableRefUtil::move(tmp);
1320#else
1321 *out = { {basic_format_arg<t_CONTEXT>(fmt_args_01),
1322 basic_format_arg<t_CONTEXT>(fmt_args_02),
1323 basic_format_arg<t_CONTEXT>(fmt_args_03),
1324 basic_format_arg<t_CONTEXT>(fmt_args_04),
1325 basic_format_arg<t_CONTEXT>(fmt_args_05),
1326 basic_format_arg<t_CONTEXT>(fmt_args_06),
1327 basic_format_arg<t_CONTEXT>(fmt_args_07),
1328 basic_format_arg<t_CONTEXT>(fmt_args_08),
1329 basic_format_arg<t_CONTEXT>(fmt_args_09),
1330 basic_format_arg<t_CONTEXT>(fmt_args_10)} };
1331#endif
1332}
1333#endif // BSLFMT_FORMAT_ARG_VARIADIC_LIMIT_B >= 10
1334
1335#else
1336// The generated code below is a workaround for the absence of perfect
1337// forwarding in some compilers.
1338template <class t_CONTEXT, class... t_FMTARGS>
1339inline
1341 bsl::array<basic_format_arg<t_CONTEXT>, sizeof...(t_FMTARGS)> *out,
1342 t_FMTARGS&... fmt_args)
1343{
1344#ifndef BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS
1345 bsl::array<basic_format_arg<t_CONTEXT>, sizeof...(t_FMTARGS)> tmp = {
1346 {basic_format_arg<t_CONTEXT>(fmt_args)...}};
1347 *out = bslmf::MovableRefUtil::move(tmp);
1348#else
1349 *out = { {basic_format_arg<t_CONTEXT>(fmt_args)...} };
1350#endif
1351}
1352// }}} END GENERATED CODE
1353#endif
1354
1355// FREE FUNCTIONS
1356
1357#if defined(BSLS_LIBRARYFEATURES_HAS_CPP14_BASELINE_LIBRARY) && \
1358 defined(BSLS_LIBRARYFEATURES_HAS_CPP14_INTEGER_SEQUENCE)
1359 // This check is a proxy for BSL_VARIANT_FULL_IMPLEMENTATION which is unset
1360 // at the end of bslstl_variant.h
1361template <class t_VISITOR, class t_CONTEXT>
1362inline
1363decltype(auto) visit_format_arg(t_VISITOR&& visitor,
1364 basic_format_arg<t_CONTEXT> arg)
1365{
1366 return arg.visit(std::forward<t_VISITOR>(visitor));
1367}
1368#else
1369template <class t_VISITOR, class t_CONTEXT>
1370inline
1372visit_format_arg(t_VISITOR& visitor, basic_format_arg<t_CONTEXT> arg)
1373{
1374 return arg.visit(visitor);
1375}
1376#endif
1377
1378} // close package namespace
1379
1380
1381#else // if ! defined(DEFINED_BSLFMT_FORMAT_ARG_H)
1382# error Not valid except when included from bslfmt_format_arg.h
1383#endif // ! defined(COMPILING_BSLFMT_FORMAT_ARG_H)
1384
1385#endif // ! defined(INCLUDED_BSLFMT_FORMAT_ARG_CPP03)
1386
1387// ----------------------------------------------------------------------------
1388// Copyright 2023 Bloomberg Finance L.P.
1389//
1390// Licensed under the Apache License, Version 2.0 (the "License");
1391// you may not use this file except in compliance with the License.
1392// You may obtain a copy of the License at
1393//
1394// http://www.apache.org/licenses/LICENSE-2.0
1395//
1396// Unless required by applicable law or agreed to in writing, software
1397// distributed under the License is distributed on an "AS IS" BASIS,
1398// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1399// See the License for the specific language governing permissions and
1400// limitations under the License.
1401// ----------------------------- END-OF-FILE ----------------------------------
1402
1403/** @} */
1404/** @} */
1405/** @} */
Definition bslstl_stringview.h:471
Definition bslstl_string.h:1252
Definition bslmf_invokeresult.h:362
Definition bslstl_variant.h:3806
static void makeFormatArgArray(bsl::array< basic_format_arg< t_CONTEXT >, sizeof...(t_FMTARGS)> *out, t_FMTARGS &... fmt_args)
Definition bslfmt_format_arg.h:875
Definition bslmf_movableref.h:752
#define BSLMF_ASSERT(expr)
Definition bslmf_assert.h:231
#define BSLS_KEYWORD_DELETED
Definition bsls_keyword.h:651
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:674
#define BSLS_UTIL_ADDRESSOF(OBJ)
Definition bsls_util.h:296
bool operator==(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
void swap(OptionValue &a, OptionValue &b)
Definition bdlat_valuetypefunctions.h:939
BloombergLP::bsls::Nullptr_Impl::Type nullptr_t
Definition bsls_nullptr.h:283
bsl::invoke_result< t_VISITOR &, typenamebsl::variant_alternative< 0, t_VARIANT >::type & >::type visit(t_VISITOR &visitor, t_VARIANT &variant)
Definition bslstl_variant.h:2359
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
ALLOCATOR & lhs
Definition bslstl_string.h:3917
Definition bslfmt_enablestreamedformatter.h:130
basic_format_context< Format_ContextOutputIteratorRef< char >, char > format_context
Definition bslfmt_format_arg.h:170
bsl::invoke_result< t_VISITOR &, bsl::monostate & >::type visit_format_arg(t_VISITOR &visitor, basic_format_arg< t_CONTEXT > arg)
Definition bslfmt_format_arg.h:907
basic_format_context< Format_ContextOutputIteratorRef< wchar_t >, wchar_t > wformat_context
Definition bslfmt_format_arg.h:173
bsl::string format(BSLFMT_FORMAT_STRING_PARAMETER fmtStr, const t_ARGS &... args)
Definition bslfmt_format_imp.h:1085
Definition bslstl_array.h:293
Definition bslmf_enableif.h:530
Definition bslfmt_formatterbase.h:426
Definition bslmf_isintegral.h:140
Definition bslmf_issame.h:146
Definition bslstl_monostate.h:77
static MovableRef< t_TYPE > move(t_TYPE &reference) BSLS_KEYWORD_NOEXCEPT
Definition bslmf_movableref.h:1067
static t_TYPE & access(t_TYPE &ref) BSLS_KEYWORD_NOEXCEPT
Definition bslmf_movableref.h:1039