BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bslmf.h
Go to the documentation of this file.
1
/// @file bslmf.h
2
///
3
///
4
/// @defgroup bslmf Package bslmf
5
/// @brief Basic Standard Library Meta-Functions (bslmf)
6
/// @addtogroup bsl
7
/// @{
8
/// @addtogroup bslmf
9
/// @{
10
/// * <a href="#bslmf-purpose"> Purpose</a>
11
/// * <a href="#bslmf-mnemonic"> Mnemonic </a>
12
/// * <a href="#bslmf-description"> Description </a>
13
/// * <a href="#bslmf-hierarchical-synopsis"> Hierarchical Synopsis </a>
14
/// * <a href="#bslmf-component-synopsis"> Component Synopsis </a>
15
///
16
/// # Purpose {#bslmf-purpose}
17
/// Provide meta-function versions of useful coding constructs.
18
///
19
/// # Mnemonic {#bslmf-mnemonic}
20
/// Basic Standard Library Meta-Functions (bslmf)
21
///
22
/// # Description {#bslmf-description}
23
/// The 'bslmf' package provides meta-function equivalents of certain
24
/// useful coding constructs. A meta-function is a template-based, compile-time
25
/// construct that behaves like a (runtime) function in that it "evaluates"
26
/// arguments and does something different based on the input it is passed (in the
27
/// case of templates, the input it is instantiated with). 'bslmf' provides
28
/// metafunctions to evaluate (at compile time) constructs such as the following:
29
/// an 'if'-statement equivalent, whether a (template) argument is a fundamental
30
/// type, whether an argument is an 'enum' type, whether two arguments have the
31
/// same type, and more.
32
///
33
/// The "return value" of that function is generally a compile-time constant under
34
/// the form of a nested 'enum' 'VALUE', or in some cases a nested 'Type', or
35
/// both. For instance, in order to evaluate whether two types are the same, one
36
/// could write a meta-function predicate (evaluating to 0 or 1) as follows:
37
/// @code
38
/// template <class U, class V>
39
/// struct IsSame {
40
/// // This 'struct' provides a meta function parameterized by two types 'U'
41
/// // and 'V', that takes 'VALUE == 0' unless 'U' and 'V' are the same type,
42
/// // in which case it takes 'VALUE == 1'.
43
///
44
/// // PUBLIC TYPES
45
/// enum { VALUE = 0 };
46
/// typedef bslmf_MetaInt<VALUE> Type;
47
/// };
48
///
49
/// // SPECIALIZATIONS
50
/// template <class T>
51
/// struct IsSame<T, T> {
52
/// // This specialization of the 'IsSame' meta function is parameterized by
53
/// // a single type 'T' and is selected if the two parameters of 'IsSame',
54
/// // 'U' and 'V', are both equal to 'T'. It takes 'VALUE == 1'.
55
///
56
/// // PUBLIC TYPES
57
/// enum { VALUE = 1 };
58
/// typedef bslmf_MetaInt<VALUE> Type;
59
/// };
60
/// @endcode
61
/// Note the use of a 'bslmf_MetaInt' nested type usually employed for function
62
/// dispatching. See the @ref bslmf_issame component-level documentation for a more
63
/// thorough usage example.
64
///
65
/// Other meta-functions don't have a 'VALUE', but apply some type of
66
/// transformation (e.g., removing top-level 'const' qualifiers, decaying array
67
/// and function types to pointer types). Those usually have a nested 'Type'.
68
///
69
/// ## Hierarchical Synopsis {#bslmf-hierarchical-synopsis}
70
///
71
/// The 'bslmf' package currently has 100 components having 21 levels of physical
72
/// dependency. The list below shows the hierarchical ordering of the components.
73
/// The order of components within each level is not architecturally significant,
74
/// just alphabetical.
75
/// @code
76
/// 21. bslmf_isnothrowswappable
77
///
78
/// 20. bslmf_isswappable
79
/// bslmf_unwraprefdecay
80
///
81
/// 19. bslmf_forwardingreftype
82
/// bslmf_forwardingtype
83
/// bslmf_invokeresult
84
/// bslmf_unwrapreference
85
/// bslmf_util
86
///
87
/// 18. bslmf_movableref
88
/// bslmf_referencewrapper
89
///
90
/// 17. bslmf_isbitwisemoveable
91
/// bslmf_iscopyconstructible
92
/// bslmf_isnothrowmoveconstructible
93
///
94
/// 16. bslmf_isbitwisecopyable
95
///
96
/// 15. bslmf_haspointersemantics
97
/// bslmf_isbitwiseequalitycomparable
98
/// bslmf_istriviallycopyable
99
/// bslmf_istriviallydefaultconstructible
100
/// bslmf_matcharithmetictype
101
/// bslmf_usesallocatorargt
102
///
103
/// 14. bslmf_detectnestedtrait
104
/// bslmf_isenum
105
///
106
/// 13. bslmf_isaccessiblebaseof
107
/// bslmf_isconvertibletoany
108
/// bslmf_nestedtraitdeclaration
109
/// bslmf_usesallocator
110
///
111
/// 12. bslmf_isconvertible
112
///
113
/// 11. bslmf_isfundamental
114
///
115
/// 10. bslmf_isarithmetic
116
///
117
/// 9. bslmf_isintegral
118
/// bslmf_ismemberpointer
119
///
120
/// 8. bslmf_addcv
121
/// bslmf_ismemberobjectpointer
122
///
123
/// 7. bslmf_addconst
124
/// bslmf_addvolatile
125
/// bslmf_decay
126
/// bslmf_isempty
127
/// bslmf_ismemberfunctionpointer
128
/// bslmf_ispolymorphic
129
/// bslmf_removepointer
130
///
131
/// 6. bslmf_isclass
132
/// bslmf_isfloatingpoint
133
/// bslmf_isfunction
134
/// bslmf_ispointer
135
/// bslmf_isvoid
136
/// bslmf_memberfunctionpointertraits
137
/// bslmf_memberpointertraits
138
/// bslmf_removecvq
139
/// bslmf_removecvref
140
///
141
/// 5. bslmf_addpointer
142
/// bslmf_addreference
143
/// bslmf_conjunction
144
/// bslmf_disjunction
145
/// bslmf_functionpointertraits
146
/// bslmf_if !DEPRECATED!
147
/// bslmf_makeintegersequence
148
/// bslmf_matchanytype
149
/// bslmf_metaint !DEPRECATED!
150
/// bslmf_negation
151
/// bslmf_removecv
152
/// bslmf_selecttrait
153
///
154
/// 4. bslmf_addlvaluereference
155
/// bslmf_addrvaluereference
156
/// bslmf_arraytopointer
157
/// bslmf_conditional
158
/// bslmf_enableif
159
/// bslmf_floatingtypestructuraltraits
160
/// bslmf_integersequence
161
/// bslmf_isconst
162
/// bslmf_isreference
163
/// bslmf_isvolatile
164
/// bslmf_nthparameter
165
/// bslmf_removeconst
166
/// bslmf_removeextent
167
/// bslmf_removereference
168
/// bslmf_removevolatile
169
/// bslmf_resulttype
170
/// bslmf_switch
171
/// bslmf_tag
172
/// bslmf_typeidentity
173
/// bslmf_typelist
174
///
175
/// 3. bslmf_assert
176
/// bslmf_isarray
177
/// bslmf_islvaluereference
178
/// bslmf_ispair
179
/// bslmf_isreferencewrapper
180
/// bslmf_isrvaluereference
181
/// bslmf_issame
182
/// bslmf_istransparentpredicate
183
/// bslmf_nil
184
///
185
/// 2. bslmf_allocatorargt
186
/// bslmf_booleantestable
187
/// bslmf_containercompatiblerange
188
/// bslmf_integralconstant
189
/// bslmf_voidtype
190
///
191
/// 1. bslmf_conjunction_cpp03 !PRIVATE!
192
/// bslmf_disjunction_cpp03 !PRIVATE!
193
/// bslmf_functionpointertraits_cpp03 !PRIVATE!
194
/// bslmf_invokeresult_cpp03 !PRIVATE!
195
/// bslmf_nthparameter_cpp03 !PRIVATE!
196
/// @endcode
197
///
198
/// ## Component Synopsis {#bslmf-component-synopsis}
199
///
200
/// @ref bslmf_addconst :
201
/// Provide a meta-function for adding a top-level `const`-qualifier.
202
///
203
/// @ref bslmf_addcv :
204
/// Provide a meta-function for adding top-level cv-qualifiers.
205
///
206
/// @ref bslmf_addlvaluereference :
207
/// Provide a compile-time type transformation to lvalue reference.
208
///
209
/// @ref bslmf_addpointer :
210
/// Provide meta-function to transform a type to pointer to that type.
211
///
212
/// @ref bslmf_addreference :
213
/// Provide a meta-function for adding "reference-ness" to a type.
214
///
215
/// @ref bslmf_addrvaluereference :
216
/// Provide a compile-time type transformation to rvalue reference.
217
///
218
/// @ref bslmf_addvolatile :
219
/// Provide a meta-function for adding a `volatile`-qualifier.
220
///
221
/// @ref bslmf_allocatorargt :
222
/// Provide a tag type to precede allocator arguments.
223
///
224
/// @ref bslmf_arraytopointer :
225
/// Provide a meta-function to convert array types to pointer types.
226
///
227
/// @ref bslmf_assert :
228
/// Provide a compile-time assertion facility.
229
///
230
/// @ref bslmf_booleantestable :
231
/// Provide an exposition-only concept `boolean-testable`.
232
///
233
/// @ref bslmf_conditional :
234
/// Provide a compile-time conditional type selector.
235
///
236
/// @ref bslmf_conjunction :
237
/// Provide the logical conjunction (AND) for type traits.
238
///
239
/// @ref bslmf_conjunction_cpp03 : !PRIVATE!
240
/// Provide C++03 implementation for bslmf_conjunction.h
241
///
242
/// @ref bslmf_containercompatiblerange :
243
/// Provide a concept for the Standard `container-compatible-range`.
244
///
245
/// @ref bslmf_decay :
246
/// Convert a type to the type used for pass-by-value.
247
///
248
/// @ref bslmf_detectnestedtrait :
249
/// Provide a facility for defining traits and detecting legacy traits.
250
///
251
/// @ref bslmf_disjunction :
252
/// Provide the logical disjunction (OR) for type traits.
253
///
254
/// @ref bslmf_disjunction_cpp03 : !PRIVATE!
255
/// Provide C++03 implementation for bslmf_disjunction.h
256
///
257
/// @ref bslmf_enableif :
258
/// Provide a utility to set up SFINAE conditions in type deduction.
259
///
260
/// @ref bslmf_floatingtypestructuraltraits :
261
/// Provide traits to describe floating point type structure.
262
///
263
/// @ref bslmf_forwardingreftype :
264
/// Provide a meta-function for determining a forwarding type.
265
///
266
/// @ref bslmf_forwardingtype :
267
/// Provide a meta-function for determining an optimal forwarding type.
268
///
269
/// @ref bslmf_functionpointertraits :
270
/// Provide a meta-function for determining function pointer traits.
271
///
272
/// @ref bslmf_functionpointertraits_cpp03 : !PRIVATE!
273
/// Provide C++03 implementation for bslmf_functionpointertraits.h
274
///
275
/// @ref bslmf_haspointersemantics :
276
/// Provide a type trait for pointer semantics.
277
///
278
/// 'bslmf_if': !DEPRECATED!
279
/// Provide a compile-time `if/else` (conditional) meta-function.
280
///
281
/// @ref bslmf_integersequence :
282
/// Provide a template parameter pack of integers.
283
///
284
/// @ref bslmf_integralconstant :
285
/// Provide a mapping from integral constants to unique types.
286
///
287
/// @ref bslmf_invokeresult :
288
/// Determine the result type of an invocable expression.
289
///
290
/// @ref bslmf_invokeresult_cpp03 : !PRIVATE!
291
/// Provide C++03 implementation for bslmf_invokeresult.h
292
///
293
/// @ref bslmf_isaccessiblebaseof :
294
/// Provide a compile-time check for derived classes.
295
///
296
/// @ref bslmf_isarithmetic :
297
/// Provide a compile-time check for determining arithmetic types.
298
///
299
/// @ref bslmf_isarray :
300
/// Provide a compile-time check for array types.
301
///
302
/// @ref bslmf_isbitwisecopyable :
303
/// Provide a meta-function for determining bitwise copyable types.
304
///
305
/// @ref bslmf_isbitwiseequalitycomparable :
306
/// Provide a type trait for bitwise equality.
307
///
308
/// @ref bslmf_isbitwisemoveable :
309
/// Provide a primitive type trait for bitwise moveable classes.
310
///
311
/// @ref bslmf_isclass :
312
/// Provide a compile-time check for determining class types.
313
///
314
/// @ref bslmf_isconst :
315
/// Provide a compile-time check for `const`-qualified types.
316
///
317
/// @ref bslmf_isconvertible :
318
/// Provide a compile-time check for type conversion.
319
///
320
/// @ref bslmf_isconvertibletoany :
321
/// Provide a compile-time check for types convertible to any type.
322
///
323
/// @ref bslmf_iscopyconstructible :
324
/// Provide a meta-function to report if a type is copy constructible.
325
///
326
/// @ref bslmf_isempty :
327
/// Provide a compile-time check for detecting an empty class type.
328
///
329
/// @ref bslmf_isenum :
330
/// Provide compile-time check for determining enumerated types.
331
///
332
/// @ref bslmf_isfloatingpoint :
333
/// Provide a compile-time check for floating-point types.
334
///
335
/// @ref bslmf_isfunction :
336
/// Provide a compile-time check for determining function types.
337
///
338
/// @ref bslmf_isfundamental :
339
/// Provide a compile-time check for determining fundamental types.
340
///
341
/// @ref bslmf_isintegral :
342
/// Provide a compile-time check for integral types.
343
///
344
/// @ref bslmf_islvaluereference :
345
/// Provide a compile-time check for lvalue reference types.
346
///
347
/// @ref bslmf_ismemberfunctionpointer :
348
/// Provide a compile-time check for member function pointer types.
349
///
350
/// @ref bslmf_ismemberobjectpointer :
351
/// Provide a compile-time check for member object pointer types.
352
///
353
/// @ref bslmf_ismemberpointer :
354
/// Provide a compile-time check for non-static member pointer types.
355
///
356
/// @ref bslmf_isnothrowmoveconstructible :
357
/// Provide metafunction to identify no-throw move-constructible types.
358
///
359
/// @ref bslmf_isnothrowswappable :
360
/// Provide metafunction to identify nothrow swappable types.
361
///
362
/// @ref bslmf_ispair :
363
/// Provide a compile-time check for the bsl::pair type.
364
///
365
/// @ref bslmf_ispointer :
366
/// Provide a compile-time check for pointer types.
367
///
368
/// @ref bslmf_ispolymorphic :
369
/// Provide a compile-time check for determining polymorphic types.
370
///
371
/// @ref bslmf_isreference :
372
/// Provide a meta-function to test reference types.
373
///
374
/// @ref bslmf_isreferencewrapper :
375
/// Provide a trait to detect reference-wrapper specializations.
376
///
377
/// @ref bslmf_isrvaluereference :
378
/// Provide a compile-time check for rvalue reference types.
379
///
380
/// @ref bslmf_issame :
381
/// Provide a meta-function for testing if two types are the same.
382
///
383
/// @ref bslmf_isswappable :
384
/// Provide metafunction to identify swappable types.
385
///
386
/// @ref bslmf_istransparentpredicate :
387
/// Support detection of whether a predicate functor is transparent.
388
///
389
/// @ref bslmf_istriviallycopyable :
390
/// Provide a meta-function for determining trivially copyable types.
391
///
392
/// @ref bslmf_istriviallydefaultconstructible :
393
/// Provide a compile-time check for trivially default-constructible.
394
///
395
/// @ref bslmf_isvoid :
396
/// Provide a compile-time check for `void` types.
397
///
398
/// @ref bslmf_isvolatile :
399
/// Provide a compile-time check for `volatile`-qualified types.
400
///
401
/// @ref bslmf_makeintegersequence :
402
/// Provide a template parameter pack of integers.
403
///
404
/// @ref bslmf_matchanytype :
405
/// Provide a generic type to which any type can be converted.
406
///
407
/// @ref bslmf_matcharithmetictype :
408
/// Provide a class supporting "do-the-right-thing clause" dispatch.
409
///
410
/// @ref bslmf_memberfunctionpointertraits :
411
/// Provide meta-functions to detect member function pointer traits.
412
///
413
/// @ref bslmf_memberpointertraits :
414
/// Provide meta-function to detect pointer to member traits.
415
///
416
/// @ref bslmf_metaint : !DEPRECATED!
417
/// Provide a meta-function to map integral constants to unique types.
418
///
419
/// @ref bslmf_movableref :
420
/// Provide a vocabulary type to enable move semantics.
421
///
422
/// @ref bslmf_negation :
423
/// Provide the logical negation (NOT) for type traits.
424
///
425
/// @ref bslmf_nestedtraitdeclaration :
426
/// Provide a nested declaration to associate a class with a trait.
427
///
428
/// 'bslmf_nil':
429
/// Provide a nil type.
430
///
431
/// @ref bslmf_nthparameter :
432
/// Metafunction to return the Nth type parameter in a parameter pack
433
///
434
/// @ref bslmf_nthparameter_cpp03 : !PRIVATE!
435
/// Provide C++03 implementation for bslmf_nthparameter.h
436
///
437
/// @ref bslmf_referencewrapper :
438
/// Provide copyable, assignable object wrapper for references.
439
///
440
/// @ref bslmf_removeconst :
441
/// Provide a meta-function for removing top-level `const`-qualifier.
442
///
443
/// @ref bslmf_removecv :
444
/// Provide a meta-function for removing top-level cv-qualifiers.
445
///
446
/// @ref bslmf_removecvq :
447
/// Provide a meta-function for removing `const`/`volatile` qualifiers.
448
///
449
/// @ref bslmf_removecvref :
450
/// Provide a meta-func for removing reference-ness and cv-qualifiers.
451
///
452
/// @ref bslmf_removeextent :
453
/// Provide a metafunction to return an array type's element type.
454
///
455
/// @ref bslmf_removepointer :
456
/// Provide a meta-function to transform pointer type to referent type.
457
///
458
/// @ref bslmf_removereference :
459
/// Provide a meta-function for stripping reference-ness from types.
460
///
461
/// @ref bslmf_removevolatile :
462
/// Provide a meta-function for removing `volatile`-qualifier.
463
///
464
/// @ref bslmf_resulttype :
465
/// Provide access to `result_type` or `ResultType` nested type.
466
///
467
/// @ref bslmf_selecttrait :
468
/// Provide clean compile-time dispatch based on multiple traits
469
///
470
/// @ref bslmf_switch :
471
/// Provide a compile-time `switch` meta-function.
472
///
473
/// 'bslmf_tag':
474
/// Provide an integral-constant-to-type conversion.
475
///
476
/// @ref bslmf_typeidentity :
477
/// Provide a template metafunction that returns its argument.
478
///
479
/// @ref bslmf_typelist :
480
/// Provide a typelist component.
481
///
482
/// @ref bslmf_unwraprefdecay :
483
/// Provide a meta-function to decay and unwrap reference wrappers.
484
///
485
/// @ref bslmf_unwrapreference :
486
/// Provide a meta-function to unwrap reference wrappers.
487
///
488
/// @ref bslmf_usesallocator :
489
/// Provide a meta-function to determine if a type uses an allocator.
490
///
491
/// @ref bslmf_usesallocatorargt :
492
/// Provide a metafunction for @ref allocator_arg_t construction
493
///
494
/// @ref bslmf_util :
495
/// Provide low-level functions on `bslmf` types.
496
///
497
/// @ref bslmf_voidtype :
498
/// Provide a helper for implementing SFINAE-based metafunctions.
499
///
500
/// @}
501
/** @} */
doxygen_input
bde
groups
bsl
bslmf
doc
bslmf.h
Generated by
1.9.8