Feature-Test Macros and Policies
Document #: | SD-FeatureTest |
Date: | 2024-09-24 |
Project: | Programming Language C++ |
Audience: | |
Reply-to: |
Contents
1 Explanation and rationale for the approach
The pace of innovation in the standardization of C++ makes long-term stability of implementations unlikely. Features are added to the language because programmers want to use those features. Features are added to (the working draft of) the standard as the features become well-specified. In many cases a feature is added to an implementation well before or well after the standard officially introducing it is approved.
This process makes it difficult for programmers who want to use a
feature to know whether it is available in any given implementation.
Implementations rarely leap from one formal revision of the standard
directly to the next; the implementation process generally proceeds by
smaller steps. As a result, testing for a specific revision of the
standard (e.g. by examining the value of the
__cplusplus
macro) often gives the wrong answer. Implementers generally don’t want
to appear to be claiming full conformance to a standard revision until
all of its features are implemented. That leaves programmers with no
portable way to determine which features are actually available to
them.
It is often possible for a program to determine, in a manner specific to a single implementation, what features are supported by that implementation; but the means are often poorly documented and ad hoc, and sometimes complex – especially when the availability of a feature is controlled by an invocation option. To make this determination for a variety of implementations in a single source base is complex and error-prone.
1.1 Status quo before feature-test macros
Here is some code that attempts to determine whether rvalue references are available in the implementation in use:
#ifndef __USE_RVALUE_REFERENCES
#if (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 3) || \
_MSC_VER >= 1600
#if __EDG_VERSION__ > 0
#define __USE_RVALUE_REFERENCES (__EDG_VERSION__ >= 410)
#else
#define __USE_RVALUE_REFERENCES 1
#endif
#elif __clang__
#define __USE_RVALUE_REFERENCES __has_feature(cxx_rvalue_references)
#else
#define __USE_RVALUE_REFERENCES 0
#endif
#endif
First, the GNU and Microsoft version numbers are checked to see if they are high enough. But then a check is made of the EDG version number, since that front end also has compatibility modes for both those compilers, and defines macros indicating (claimed) compatibility with them. If the feature wasn’t implemented in the indicated EDG version, it is assumed that the feature is not available – even though it is possible for a customer of EDG to implement a feature before EDG does.
Fortunately Clang has ways to test specifically for the presence of specific features. But unfortunately, the function-call-like syntax used for such tests won’t work with a standard preprocessor, so this fine new feature winds up adding its own flavor of complexity to the mix.
Also note that this code is only the beginning of a real-world solution. A complete solution would need to take into account more compilers, and also command-line option settings specific to various compilers.
1.2 Characteristics of the proposed solution
To preserve implementers’ freedom to add features in the order that makes the most sense for themselves and their customers, implementers should indicate the availability of each separate feature by adding a definition of a macro with the name corresponding to that feature.
Important note: By recommending the use of these macros, WG21 is not making any feature optional; the absence of a definition for the relevant feature-test macro does not make an implementation that lacks a feature conform to a standard that requires the feature. However, if implementers and programmers follow these recommendations, portability of code between real-world implementations should be improved.
To a first approximation, a feature is identified by the WG21 paper in which it is specified, and by which it is introduced into the working draft of the standard. Not every paper introduces a new feature worth a feature-test macro, but every paper that is not just a collection of issue resolutions is considered a candidate; exceptions are explicitly justified.
For C++14, the feature-test macro name generally consists of some combination of words from the title of the paper. In the future, it is hoped that every paper will include its own recommendations concerning feature-test macro names.
The value specified for a feature-test macro is based on the year and month in which the feature is voted into the working draft. In a case where a feature is subsequently changed in a significant way, but arguably remains the same feature, the value of the macro is changed to indicate the “revision level” of the specification of the feature. However, in most cases it is expected that the presence of a feature can be determined by the presence of any non-zero macro value; for example:
template<typename T>
struct use_empty_base_opt :
::integral_constant<bool,
std::is_empty<T>::value
std#if __cpp_lib_is_final
&& !std::is_final<T>::value
#endif
>
{ };
To avoid the user’s namespace, names of macros for language features
are prefixed by __cpp_
; for library
features, by __cpp_lib_
. A library
feature that doesn’t introduce a new header is expected to be defined by
the header(s) that implement the feature.
1.3 Examples
Selecting a more efficient compile-time implementation based on the availability of a feature:
#if __cpp_variadic_using // can use the compile-time efficient, flat inheritance template<typename ...T> struct Callable : T... { using T::operator() ...; }; #else // fall-back to linear recursion for older compilers template<typename ...T> struct Callable; template<typename T, typename ...U> struct Callable<T, U...> : T, Callable<U...> { using T::operator(); using Callable<U...>::operator(); }; template<typename T> struct Callable<T> : T { using T::operator(); }; template<> struct Callable<> {}; #endif
Likewise
#if __cpp_fold_expressions template<typename... T> auto sum(T... args) { return (args + ...); } #else auto sum() { return 0; } template<typename T> auto sum(T t) { return t; } template(typename T, typename... Ts) auto sum(T t, Ts... ts) { return t + sum(ts...); } #endif
Selecting a more efficient run-time implementation based on the availability of a feature:
void update(std::set<X>& set, const X& elem, int val) { auto pos = set.find(elem); if (pos == set.end()) return; #if __cpp_lib_node_extract auto next = std::next(pos); auto x = set.extract(pos); .value().update(val); x.insert(next, std::move(x)); set#else = *pos; X tmp = set.erase(pos); pos .update(val); tmp.insert(pos, std::move(tmp)); set#endif }
In some cases, the value of a feature-test macro can change over time as the underlying feature changes. To make it easier to follow the evolution of each feature, the tables in this document are grouped by macro name - with a row for each possible value and the proposal(s) associated with it.
Conditionally implementing a feature, based on __cpp_static_assert
.
#if __cpp_static_assert # if __cpp_static_assert > 201400 # define Static_Assert(cond) static_assert(cond) # else # define Static_Assert(cond) static_assert(cond, #cond) # endif # define Static_Assert_Msg(cond, msg) static_assert(cond, msg) #else # define Static_Assert(cond) # define Static_Assert_Msg(cond, msg) #endif
Attributes can also change semantics over time, which is why the
__has_cpp_attribute
facility described below evaluates to a value rather than simply
1
or
0
. This
allows a user to conditionally provide a version of nodiscard based on
__has_cpp_attribute(nodiscard)
:
#if __has_cpp_attribute(nodiscard) >= 201907 // nodiscard has a reason and can // be applied to constructors # define NODISCARD(msg) [[nodiscard(msg)]] # define NODISCARD_CTOR(msg) [[nodiscard(msg)]] #elif __has_cpp_attribute(nodiscard) >= 201603 // nodiscard doesn't have a reason, nor can # define NODISCARD(msg) [[nodiscard]] # define NODISCARD_CTOR(msg) #else // nodiscard doesn't exist at all yet # define NODISCARD(msg) # define NODISCARD_CTOR(msg) #endif
2 Recommendations
2.1 Introduction
For the sake of improved portability between partial implementations of various C++ standards, WG21 (the ISO technical committee for the C++ programming language) recommends that implementers and programmers follow the guidelines in this document concerning feature-test macros.
Implementers who provide a new standard feature should define a macro with the recommended name and value, in the same circumstances under which the feature is available (for example, taking into account relevant command-line options), to indicate the presence of support for that feature.
Programmers who wish to determine whether a feature is available in an implementation should base that determination on the state of the macro with the recommended name. (The absence of a tested feature may result in a program with decreased functionality, or the relevant functionality may be provided in a different way. A program that strictly depends on support for a feature can just try to use the feature unconditionally; presumably, on an implementation lacking necessary support, translation will fail. Therefore, if the most useful purpose for a feature-test macro would be to control the inclusion of a #error directive if the feature is unavailable, that is considered inadequate justification for the macro. Note that the usefulness of a test macro for a feature is completely independent of the usefulness of the feature itself.)
2.2 Testing for the presence of a
header: __has_include
It is impossible for a C++ program to directly, reliably, and portably determine whether or not a library header is available for inclusion. Conditionally including a header requires the use of a configuration macro, whose setting can be determined by a configuration-test process at build time (reliable, but less portable), or by some other means (often not reliable or portable).
To solve this general problem, WG21 recommends that programmers use
the __has_include
feature.
2.2.1 Syntax
h-preprocessing-token:
any preprocessing-token other than>
h-pp-tokens:
h-preprocessing-token
h-pp-tokens h-preprocessing-token
has-include-expression:
__has_include
(
header-name)
__has_include
(
string-literal)
__has_include
(
<
h-pp-tokens>
)
2.2.2 Semantics
In the first form of the has-include-expression, the parenthesized header-name token is not subject to macro expansion. The second and third forms are considered only if the first form does not match, and the preprocessing tokens are processed just as in normal text.
A has-include-expression shall appear only in the
controlling constant expression of a #if
or #elif
directive ([cpp.cond] 16.1). Prior to the evaluation of such an
expression, the source file identified by the parenthesized
preprocessing token sequence in each contained
has-include-expression is searched for as if that preprocessing
token sequence were the pp-tokens in a
#include
directive, except that no further macro expansion is performed. If such
a directive would not satisfy the syntactic requirements of a
#include
directive, the program is ill-formed. The
has-include-expression is replaced by the pp-number
1
if the
search for the source file succeeds, and by the pp-number
0
if the
search fails.
The #ifdef
and #ifndef
directives, and the defined conditional inclusion operator, shall treat
__has_include
as
if it were the name of a defined macro. The identifier __has_include
shall not appear in any context not mentioned in this section.
2.2.3 Example
This demonstrates a way to use a library optional facility only if it
is available. Note that having __has_include(<optional>)
succeed is insufficient since on many toolchains, headers may exist in
installations but have their contents guarded based on compile flags.
For example, the following:
#ifdef __has_include
#if __has_include(<optional>)
#include <optional>
::optional<int> o;
std#endif
#endif
int main(){ }
will still fail to compile with g++ -std=c++14
(using libstdc++).
Hence, we need to do:
#ifdef __has_include
# if __has_include(<optional>)
# include <optional>
# if __cpp_lib_optional >= 201606
# define have_optional 1
# endif
# elif __has_include(<experimental/optional>)
# include <experimental/optional>
# if __cpp_lib_experimental_optional >= 201400
# define have_optional 1
# define experimental_optional 1
# endif
#endif
#ifndef have_optional
# define have_optional 0
#endif
Additionally, the <version>
header [P0754R2] is a light-weight header that
defines all the standard library feature-test macros. An alternate
implementation could be:
#ifndef __has_include
# define __has_include(x) 0
#endif
#if __has_include(<version>)
# include <version>
#elif __has_include(<optional>)
# include <optional>
#endif
#if __cpp_lib_optional >= 201606
# define have_optional 1
#else
# define have_optional 0
#endif
2.3 Testing for the presence of an
attribute: __has_cpp_attribute
A C++ program cannot directly, reliably, and portably determine whether or not a standard or vendor-specific attribute is available for use. Testing for attribute support generally requires complex macro logic, as illustrated above for language features in general.
To solve this general problem, WG21 recommends that programmers use
the __has_cpp_attribute
feature.
2.3.1 Syntax
has-attribute-expression:
__has_cpp_attribute
(
attribute-token)
2.3.2 Semantics
A has-attribute-expression shall appear only in the
controlling constant expression of a #if
or #elif
directive ([cpp.cond] 16.1). The has-attribute-expression is
replaced by a non-zero pp-number if the implementation
supports an attribute with the specified name, and by the
pp-number
0
otherwise.
For a standard attribute, the value of the __has_cpp_attribute
macro is based on the year and month in which the attribute was voted
into the working draft. In the case where the attribute is
vendor-specific, the value is implementation-defined. However, in most
cases it is expected that the availability of an attribute can be
detected by any non-zero result.
The #ifdef
and #ifndef
directives, and the defined conditional inclusion operator, shall treat
__has_cpp_attribute
as if it were the name of a defined macro. The identifier __has_cpp_attribute
shall not appear in any context not mentioned in this section.
2.3.3 Example
This demonstrates a way to use the attribute [[deprecated]]
only if it is available.
#ifndef __has_cpp_attribute
# define __has_cpp_attribute(x) 0
#endif
#if __has_cpp_attribute(deprecated)
# define ATTR_DEPRECATED(msg) [[deprecated(msg)]]
#else
# define ATTR_DEPRECATED(msg)
#endif
3 Policies
SG-10 has adopted a number of policies related to our standard practices for determining and naming macros.
3.1
constexpr
For the language, we will have a single
__cpp_constexpr
macro. It will be
bumped every time we extend constexpr in the language. For the library,
we will add a specific feature-test macros for significant, special
features. Otherwise, for those cases where we are just adding constexpr
to more things in the library, we will have a dedicated test macro per
header and just bump that header-specific macro on each change. That
macro will be named
__cpp_lib_constexpr_HEADER
(with the
exception of a few preexisting macros for array and algorithm which have
slightly different names).
From [P1902R1].
3.2 Language Features with Library Components
In some cases a feature requires two macros, one for the language and one for the library. For example, the library does not want to define its three-way comparison operations unless the compiler supports the feature.
For end-users, it is suggested that they test only the library macro,
as that will only be true if the language macro is also true. As a
result, the language macros contain
“impl
” to distinguish them from the
more general version that is expected to be set by the library.
Note that originally SG10 suggested that the library version of the
macro not include the usual _lib
part, but LWG was not comfortable with the inconsistency of having a
library macro (which requires a header before it can be used) that does
not contain _lib
.
Also note that SG10 originally proposed that the core feature tests
include _lang
, but LWG wanted
something that more clearly implied that the the macro was for a core
feature and not intended to be used by end-users. They sugggested that
_impl
be used instead.
From [P1353R0].
4 Table of Feature-Test Macros
The following are all the feature-test macros in the standard, broken up by language macros, attribute macros, and library macros, then sorted by name. Each macro will contain its list of possible values and the papers necessary to be implemented before an implementation should define that macro with that particular value.
Note that a given paper may introduce or update multiple feature-test
macros. A given value may require multiple papers. A paper may also
remove a feature-test macro, in which case its value will be
specified as deleted.
4.1 Language Feature-Test Macros
All of the language macros are predefined (i.e. no header needs to be included before doing checks).
In some cases, a feature requires two macros: one for the language
and one for the library. For example, the library does not want to
define its three-way comparison operators unless the compiler supports
the feature. In these cases, it is suggested for end-users that they
only test the library macro. Those core language feature-test macros
that are intended to be checked by the library are spelled
__cpp_impl_*
.
Macro | Value | Paper(s) |
---|---|---|
__cpp_deleted_function
|
202403
|
[P2573R2] = delete(“should have a reason”); |
__cpp_aggregate_bases
|
201603
|
[P0017R1] Extension to aggregate initialization |
__cpp_aggregate_nsdmi
|
201304
|
[N3653] Member initializers and aggregates |
__cpp_aggregate_paren_init
|
201902
|
[P0960R3] Allow initializing aggregates from a parenthesized list of values |
__cpp_alias_templates
|
200704
|
[N2258] Templates Aliases |
__cpp_aligned_new
|
201606
|
[P0035R4] Dynamic memory allocation for over-aligned data |
__cpp_attributes
|
200809
|
[N2761] Towards support for attributes in C++ (Revision 6) |
__cpp_binary_literals
|
201304
|
[N3472] Binary Literals in the C++ Core Language |
__cpp_capture_star_this
|
201603
|
[P0018R3] Lambda Capture of *this
by Value as [=,*this]
|
__cpp_char8_t
|
201811
|
[P0482R6]
char8_t : A
type for UTF-8 characters and strings (Revision 6)
|
202207
|
[P2513R3] char8_t Compatibility and Portability Fix | |
__cpp_concepts
|
201707
|
[P0734R0] Wording Paper, C++ extensions for Concepts |
201811
|
[P1084R2] Today’s return-type-requirements Are Insufficient | |
201907
|
[P1452R2] On the non-uniform semantics of return-type-requirements | |
202002
|
[P0848R3] Conditionally Trivial Special Member Functions | |
__cpp_conditional_explicit
|
201806
|
[P0892R2] explicit(bool)
|
__cpp_consteval
|
201811
|
[P1073R3] Immediate functions |
202211
|
[P2564R3] consteval needs to propagate up | |
__cpp_constexpr
|
200704
|
[N2235] Generalized Constant Expressions—Revision 5 |
201304
|
[N3652] Relaxing constraints on constexpr functions / constexpr member functions and implicit const | |
201603
|
[P0170R1] Wording for Constexpr Lambda | |
201806
|
[P1064R0] Allowing Virtual Function Calls in Constant Expressions | |
201811
|
[P1002R1] Try-catch blocks in constexpr
functions [P1327R1] Allowing dynamic_cast, polymorphic typeid in Constant Expressions |
|
201907
|
[P1331R2] Permitting trivial default
initialization in constexpr contexts [P1668R1] Enabling constexpr Intrinsics By Permitting Unevaluated inline-assembly in constexpr Functions |
|
202002
|
[P1330R0] Changing the active member of a union inside constexpr | |
202110
|
[P2242R3] Non-literal variables (and labels and gotos) in constexpr functions | |
202207
|
[P2448R2] Relaxing some constexpr restrictions | |
202211
|
[P2647R1] Permitting static constexpr variables in constexpr functions | |
202306
|
[P2738R1] constexpr cast from void*: towards constexpr type-erasure | |
__cpp_constexpr_dynamic_alloc
|
201907
|
[P0784R7] More constexpr containers |
__cpp_constexpr_in_decltype
|
201711
|
[P0859R0] Core Issue 1581: When are constexpr member functions defined? |
__cpp_constinit
|
201907
|
[P1143R2] Adding the
constinit
keyword
|
__cpp_decltype
|
200707
|
[N2343] Decltype (revision 7): proposed wording |
__cpp_decltype_auto
|
201304
|
[N3638] Return type deduction for normal functions |
__cpp_deduction_guides
|
201606
|
[P0091R3] Template argument deduction for class templates (Rev. 6) |
201611
|
[P0512R0] Class Template Argument Deduction Assorted NB resolution and issues | |
201703
|
[P0620R0] Drafting for class template argument deduction issues | |
201907
|
[P1814R0] Wording for Class Template
Argument Deduction for Alias Templates [P1816R0] Wording for class template argument deduction for aggregates |
|
__cpp_delegating_constructors
|
200604
|
[N1986] Delegating Constructors (revision 3) |
__cpp_designated_initializers
|
201707
|
[P0329R4] Designated Initialization Wording |
__cpp_enumerator_attributes
|
201411
|
[N4266] Attributes for namespaces and enumerators |
__cpp_exceptions
|
199711
|
Exception handling |
__cpp_explicit_this_parameter
|
202110
|
[P0847R7] Deducing this |
__cpp_fold_expressions
|
201411
|
[N4295] Folding Expressions |
201603
|
[P0036R0] Unary Folds and Empty Parameter Packs (Revision 1) | |
__cpp_generic_lambdas
|
201304
|
[N3649] Generic (Polymorphic) Lambda Expressions (Revision 3) |
201707
|
[P0428R2] Familiar template syntax for generic lambdas | |
__cpp_guaranteed_copy_elision
|
201606
|
[P0135R1] Wording for guaranteed copy elision through simplified value categories |
__cpp_hex_float
|
201603
|
[P0245R1] Hexadecimal float literals for C++ |
__cpp_if_consteval
|
202106
|
[P1938R3] if consteval |
__cpp_if_constexpr
|
201606
|
[P0292R2] constexpr if: A slightly different syntax |
__cpp_impl_coroutine
|
201902
|
[P0912R5] Merge Coroutines TS into C++20
working draft [LWG3393] Missing/incorrect feature test macro for coroutines |
__cpp_impl_destroying_delete
|
201806
|
[P0722R3] Efficient sized delete for variable sized classes |
__cpp_impl_three_way_comparison
|
201711
|
[P0515R3] Consistent comparison
[P0768R1] Library Support for the Spaceship (Comparison) Operator |
201902
|
[P1185R2] <=> != ==
|
|
201907
|
[P1630R1] Spaceship needs a tune-up | |
__cpp_implicit_move
|
202207
|
[P2266R3] Simpler implicit move |
__cpp_inheriting_constructors
|
200802
|
[N2540] Inheriting Constructors (revision 5) |
201511
|
[P0136R1] Rewording inheriting constructors (core issue 1941 et al) | |
__cpp_init_captures
|
201304
|
[N3648] Wording Changes for Generalized Lambda-capture |
201803
|
[P0780R2] Allow pack expansion in lambda init-capture | |
__cpp_initializer_lists
|
200806
|
[N2672] Initializer List proposed wording |
__cpp_inline_variables
|
201606
|
[P0386R2] Inline Variables |
__cpp_lambdas
|
200907
|
[N2927] New wording for C++0x Lambdas (rev. 2) |
__cpp_modules
|
201907
|
[P1103R3] Merging Modules [P1811R0] Relaxing redefinition restrictions for re-exportation robustness |
__cpp_multidimensional_subscript
|
202110
|
[P2128R6] Multidimensional subscript operator |
202211
|
[P2589R1] static operator[] | |
__cpp_named_character_escapes
|
202207
|
[P2071R2] Named universal character escapes |
__cpp_namespace_attributes
|
201411
|
[N4266] Attributes for namespaces and enumerators |
__cpp_noexcept_function_type
|
201510
|
[P0012R1] Make exception specifications be part of the type system, version 5 |
__cpp_nontype_template_args
|
201411
|
[N4268] Allow constant evaluation for all non-type template arguments |
201911
|
[P1907R1] Inconsistencies with non-type template parameters | |
__cpp_nontype_template_parameter_auto
|
201606
|
[P0127R2] Declaring non-type template arguments with auto |
__cpp_nontype_template_parameter_class
|
201806
|
[P0732R2] Class Types in Non-Type Template Parameters |
|
[P1907R1] Inconsistencies with non-type template parameters | |
__cpp_nsdmi
|
200809
|
[N2756] Non-static data member initializers |
__cpp_pack_indexing
|
202311
|
[P2662R3] Pack Indexing |
__cpp_placeholder_variables
|
202306
|
[P2169R4] A Nice Placeholder With No Name |
__cpp_range_based_for
|
200907
|
[N2930] Range-Based For Loop Wording (Without Concepts) |
201603
|
[P0184R0] Generalizing the Range-Based For Loop | |
202211
|
[P2644R1] Final Fix of Broken Range based
for Loop Rev 1 [P2718R0] Wording for P2644R1 Fix for Range-based for Loop [CWG2659] Missing feature-test macro for lifetime extension in range-for loop |
|
__cpp_raw_strings
|
200710
|
[N2442] Raw and Unicode String Literals; Unified Proposal (Rev. 2) |
__cpp_ref_qualifiers
|
200710
|
[N2439]
Extending move semantics to *this
(revised wording)
|
__cpp_return_type_deduction
|
201304
|
[N3638] Return type deduction for normal functions |
__cpp_rtti
|
199711
|
Run-time type identification |
__cpp_rvalue_references
|
200610
|
[N2118] A Proposal to Add an Rvalue Reference to the C++ Language: Proposed Wording: Revision 3 |
__cpp_size_t_suffix
|
202011
|
[P0330R8] Literal Suffixes for (signed) size_t |
__cpp_sized_deallocation
|
201309
|
[N3778] C++ Sized Deallocation |
__cpp_static_assert
|
200410
|
[N1720] Proposal to Add Static Assertions to the Core Language (Revision 3) |
201411
|
[N3928] Extending static_assert, v2 | |
202306
|
[P2741R3] user-generated static_assert messages | |
__cpp_static_call_operator
|
202207
|
[P1169R4] static operator() |
__cpp_structured_bindings
|
201606
|
[P0217R3] Proposed wording for structured bindings |
202403
|
[P0609R3] Attributes for Structured Bindings | |
__cpp_template_template_args
|
201611
|
[P0522R0] DR: Matching of template template-arguments excludes compatible templates |
__cpp_threadsafe_static_init
|
200806
|
[N2660] Dynamic Initialization and Destruction with Concurrency |
__cpp_unicode_characters
|
200704
|
[N2249] New Character Types in C++ |
__cpp_unicode_literals
|
200710
|
[N2442] Raw and Unicode String Literals; Unified Proposal (Rev. 2) |
__cpp_user_defined_literals
|
200809
|
[N2765] User-defined Literals (aka. Extensible Literals (revision 5)) |
__cpp_using_enum
|
201907
|
[P1099R5] Using Enum |
__cpp_variable_templates
|
201304
|
[N3651] Variable Templates (Revision 1) |
__cpp_variadic_friend
|
202403
|
[P2893R3] Variadic Friends |
__cpp_variadic_templates
|
200704
|
[N2242] Proposed Wording for Variadic Templates (Revision 2) |
__cpp_variadic_using
|
201611
|
[P0195R2] Pack expansions in using-declarations |
4.2 Attribute Feature-Test Macros
All of the following macros are predefined.
Macro | Value | Paper(s) |
---|---|---|
__has_cpp_attribute(assume)
|
202207
|
[P1774R8] Portable assumptions
[CWG2615] Missing __has_cpp_attribute(assume) |
__has_cpp_attribute(carries_dependency)
|
200809
|
[N2782] C++ Data-Dependency Ordering: Function Annotation |
__has_cpp_attribute(deprecated)
|
201309
|
[N3760]
[[deprecated]]
attribute
|
__has_cpp_attribute(fallthrough)
|
201603
|
[P0188R1] Wording for [[fallthrough]]
attribute
|
__has_cpp_attribute(likely)
|
201803
|
[P0479R5] Proposed wording for likely and unlikely attributes |
__has_cpp_attribute(maybe_unused)
|
201603
|
[P0212R1] Wording for [[maybe_unused]]
attribute
|
__has_cpp_attribute(no_unique_address)
|
201803
|
[P0840R2] Language support for empty objects |
__has_cpp_attribute(nodiscard)
|
201603
|
[P0189R1] Wording for [[nodiscard]]
attribute
|
201907
|
[P1301R4] [[nodiscard("should have a reason")]]
[P1771R1] [[nodiscard]]
for constructors
|
|
__has_cpp_attribute(noreturn)
|
200809
|
[N2761] Towards support for attributes in C++ (Revision 6) |
__has_cpp_attribute(unlikely)
|
201803
|
[P0479R5] Proposed wording for likely and unlikely attributes |
4.3 Library Feature-Test Macros
All of the following macros are defined after inclusion of the header
<version>
or one of the corresponding headers specified below.
Macro | Header(s) | Value | Paper(s) |
---|---|---|---|
__cpp_lib_adaptor_iterator_pair_constructor
|
<queue>
<stack>
|
202106
|
[P1425R4] Iterators pair constructors for stack and queue |
__cpp_lib_addressof_constexpr
|
<memory>
|
201603
|
[LWG2296] std::addressof
should be
constexpr
|
__cpp_lib_algorithm_iterator_requirements
|
<algorithm>
<memory>
<numeric>
|
202207
|
[P2408R5] Ranges iterators as inputs to non-Ranges algorithms |
__cpp_lib_allocate_at_least
|
<memory>
|
202106
|
[P0401R6] Providing size feedback in the Allocator interface |
202306
|
[LWG3887] Version macro for allocate_at_least | ||
__cpp_lib_allocator_traits_is_always_equal
|
<deque>
<forward_list>
<list>
<map>
<memory>
<scoped_allocator>
<set>
<string>
<unordered_map>
<unordered_set>
<vector>
|
201411
|
[N4258]
Cleaning up
noexcept in
the Library (Rev 3)
|
__cpp_lib_any
|
<any>
|
201603
|
[P0220R1] Adopt Library Fundamentals V1 TS Components for C++17 (R1) |
201606
|
[P0032R3] Homogeneous interface for variant, any and optional (Revision 3) | ||
__cpp_lib_apply
|
<tuple>
|
201603
|
[P0220R1] Adopt Library Fundamentals V1 TS Components for C++17 (R1) |
__cpp_lib_array_constexpr
|
<array>
<iterator>
|
201603
|
[P0031R0] A Proposal to Add Constexpr Modifiers to reverse_iterator, move_iterator, array and Range Access |
201803
|
[P0858R0] Constexpr iterator requirements
[LWG3257] Missing feature testing macro update from P0858 |
||
201806
|
[P1023R0] constexpr comparison operators for std::array | ||
201811
|
[P1032R1] Misc constexpr bits | ||
__cpp_lib_as_const
|
<utility>
|
201510
|
[P0007R1] Constant View: A proposal for a
std::as_const
helper function template
|
__cpp_lib_associative_heterogeneous_erasure
|
<map>
<set>
<unordered_map>
<unordered_set>
|
202110
|
[P2077R3] Heterogeneous erasure overloads for associative containers |
__cpp_lib_associative_heterogeneous_insertion
|
<map>
<set>
<unordered_map>
<unordered_set>
|
202306
|
[P2363R5] Extending associative containers with the remaining heterogeneous overloads |
__cpp_lib_assume_aligned
|
<memory>
|
201811
|
[P1007R3] std::assume_aligned |
__cpp_lib_atomic_flag_test
|
<atomic>
|
201907
|
[P1135R6] The C++20 Synchronization Library |
__cpp_lib_atomic_float
|
<atomic>
|
201711
|
[P0020R6] Floating Point Atomic |
__cpp_lib_atomic_is_always_lock_free
|
<atomic>
|
201603
|
[P0152R1] constexpr atomic<T>::is_always_lock_free
|
__cpp_lib_atomic_lock_free_type_aliases
|
<atomic>
|
201907
|
[P1135R6] The C++20 Synchronization Library |
__cpp_lib_atomic_min_max
|
<atomic>
|
202403
|
[P0493R5] Atomic maximum/minimum |
__cpp_lib_atomic_ref
|
<atomic>
|
201806
|
[P0019R8] Atomic Ref |
<memory>
|
201711
|
[P0718R2] Revising atomic_shared_ptr for C++20 | |
__cpp_lib_atomic_value_initialization
|
<atomic>
<memory>
|
201911
|
[P0883R2] Fixing Atomic Initialization |
__cpp_lib_atomic_wait
|
<atomic>
|
201907
|
[P1135R6] The C++20 Synchronization Library |
__cpp_lib_barrier
|
<barrier>
|
201907
|
[P1135R6] The C++20 Synchronization Library |
202302
|
[P2588R3] Relax std::barrier phase completion step guarantees | ||
__cpp_lib_bind_back
|
<functional>
|
202202
|
[P2387R3] Pipe support for user-defined range adaptors |
202306
|
[P2714R1] Bind front and back to NTTP callables | ||
__cpp_lib_bind_front
|
<functional>
|
201811
|
[P0356R5] Simplified partial function application |
201907
|
[P1651R0] bind_front should not unwrap reference_wrapper | ||
202306
|
[P2714R1] Bind front and back to NTTP callables | ||
__cpp_lib_bit_cast
|
<bit>
|
201806
|
[P0476R2] Bit-casting object representations |
__cpp_lib_bitops
|
<bit>
|
201907
|
[P0553R4] Bit operations |
__cpp_lib_bitset
|
<bitset>
|
202306
|
[P2697R1] Interfacing bitset with string_view |
__cpp_lib_bool_constant
|
<type_traits>
|
201505
|
[N4389]
Wording for bool_constant , revision
1
|
__cpp_lib_bounded_array_traits
|
<type_traits>
|
201902
|
[P1357R1] Traits for [Un]bounded Arrays |
__cpp_lib_boyer_moore_searcher
|
<functional>
|
201603
|
[P0220R1] Adopt Library Fundamentals V1 TS Components for C++17 (R1) |
__cpp_lib_byte
|
<cstddef>
|
201603
|
[P0298R3] A byte type definition |
__cpp_lib_byteswap
|
<bit>
|
202110
|
[P1272R4] Byteswapping for fun&&nuf |
__cpp_lib_char8_t
|
<atomic>
<filesystem>
<istream>
<limits>
<locale>
<ostream>
<string>
<string_view>
|
201811
|
[P0482R6]
char8_t : A
type for UTF-8 characters and strings (Revision 6)
|
201907
|
[P1423R3]
char8_t
backward compatibility remediation
|
||
__cpp_lib_chrono
|
<chrono>
|
201510
|
[P0092R1] Polishing <chrono>
|
201611
|
[P0505R0] Wording for GB 50 | ||
201803
|
[P0355R7] Extending <chrono>
to Calendars and Time Zones
|
||
201907
|
[P1466R3] Miscellaneous minor fixes for chrono | ||
202306
|
[P2592R3] Hashing support for std::chrono value classes | ||
__cpp_lib_chrono_udls
|
<chrono>
|
201304
|
[N3642] User-defined Literals for Standard Library Types (part 1 - version 4) |
__cpp_lib_clamp
|
<algorithm>
|
201603
|
[P0025R0] An algorithm to “clamp” a value between a pair of boundary values |
__cpp_lib_common_reference
|
<type_traits>
|
202302
|
[P2655R3] common_reference_t of reference_wrapper Should Be a Reference Type |
__cpp_lib_common_reference_wrapper
|
<functional>
|
202302
|
[P2655R3] common_reference_t of reference_wrapper Should Be a Reference Type |
__cpp_lib_complex_udls
|
<complex>
|
201309
|
[N3779]
User-defined Literals for
std::complex
|
__cpp_lib_concepts
|
<compare>
<concepts>
|
201806
|
[P0898R3] Standard Library Concepts |
201907
|
[P1754R1] Rename concepts to standard_case for C++20, while we still can | ||
202002
|
[P1964R2] Wording for boolean-testable
|
||
202207
|
[P2404R3] Move-only types for equality_comparable_with, totally_ordered_with, and three_way_comparable_with | ||
__cpp_lib_constexpr_algorithms
|
<algorithm>
<utility>
|
201703
|
[P0202R3] Add Constexpr Modifiers to
Functions in <algorithm>
and <utility>
Headers
|
201806
|
[P0879R0] Constexpr for swap and swap
related functions [LWG3256] Feature testing macro for constexpr algorithms [LWG3792] __cpp_lib_constexpr_algorithms should also be defined in |
||
202306
|
[P2562R1] constexpr Stable Sorting | ||
__cpp_lib_constexpr_bitset
|
<bitset>
|
202207
|
[P2417R2] A more constexpr bitset |
__cpp_lib_constexpr_charconv
|
<charconv>
|
202207
|
[P2291R3] Add Constexpr Modifiers to Functions to_chars and from_chars for Integral Types in Header |
__cpp_lib_constexpr_cmath
|
<cmath>
<cstdlib>
|
202202
|
[P0533R9] constexpr for cmath and cstdlib |
202306
|
[P1383R2] More constexpr for cmath and complex | ||
__cpp_lib_constexpr_complex
|
<complex>
|
201711
|
[P0415R1] Constexpr for std::complex |
202306
|
[P1383R2] More constexpr for cmath and complex | ||
__cpp_lib_constexpr_dynamic_alloc
|
<memory>
|
201907
|
[P0784R7] More constexpr containers |
__cpp_lib_constexpr_functional
|
<functional>
|
201811
|
[P1032R1] Misc constexpr bits |
201907
|
[P1065R2] constexpr
INVOKE
|
||
__cpp_lib_constexpr_iterator
|
<iterator>
|
201811
|
[P1032R1] Misc constexpr bits |
__cpp_lib_constexpr_memory
|
<memory>
|
201811
|
[P1006R1] Constexpr in std::pointer_traits |
202202
|
[P2273R3] Making std::unique_ptr constexpr | ||
__cpp_lib_constexpr_numeric
|
<numeric>
|
201911
|
[P1645R1] constexpr for numeric algorithms |
__cpp_lib_constexpr_string
|
<string>
|
201611
|
[P0426R1] Constexpr for std::char_traits |
201811
|
[P1032R1] Misc constexpr bits | ||
201907
|
[P0980R1] Making
std::string
constexpr
|
||
__cpp_lib_constexpr_string_view
|
<string_view>
|
201611
|
[P0426R1] Constexpr for std::char_traits |
201811
|
[P1032R1] Misc constexpr bits | ||
__cpp_lib_constexpr_tuple
|
<tuple>
|
201811
|
[P1032R1] Misc constexpr bits |
__cpp_lib_constexpr_typeinfo
|
<typeinfo>
|
202106
|
[P1328R1] Making std::type_info::operator== constexpr |
__cpp_lib_constexpr_utility
|
<utility>
|
201811
|
[P1032R1] Misc constexpr bits |
__cpp_lib_constexpr_vector
|
<vector>
|
201907
|
[P1004R2] Making
std::vector
constexpr
|
__cpp_lib_constrained_equality
|
<optional>
<tuple>
<utility>
<variant>
|
202403
|
[P2944R3] Comparisons for reference_wrapper |
__cpp_lib_containers_ranges
|
<deque>
<forward_list>
<list>
<map>
<queue>
<set>
<stack>
<string>
<unordered_map>
<unordered_set>
<vector>
|
202202
|
[P1206R7] Conversions from ranges to containers |
__cpp_lib_copyable_function
|
<functional>
|
202306
|
[P2548R6] copyable_function |
__cpp_lib_coroutine
|
<coroutine>
|
201902
|
[P0912R5] Merge Coroutines TS into C++20
working draft [LWG3393] Missing/incorrect feature test macro for coroutines |
__cpp_lib_debugging
|
<debugging>
|
202311
|
[P2546R5] Debugging Support |
202403
|
[P2810R4] is_debugger_present is_replaceable | ||
__cpp_lib_deduction_guides
|
201703
|
[P0433R2] Toward a resolution of US7 and US14: Integrating template deduction for class templates into the standard library | |
__cpp_lib_default_template_type_for_algorithm_values
|
<algorithm>
<deque>
<forward_list>
<list>
<ranges>
<string>
<vector>
|
202403
|
[P2248R8] Enabling list-initialization for algorithms |
__cpp_lib_destroying_delete
|
<new>
|
201806
|
[P0722R3] Efficient sized delete for variable sized classes |
<memory>
|
201603
|
[P0033R1] Re-enabling shared_from_this (revision 1) | |
__cpp_lib_endian
|
<bit>
|
201907
|
[P0463R1] endian, Just endian [P1612R1] Relocate Endian’s Specification |
__cpp_lib_erase_if
|
<deque>
<forward_list>
<list>
<map>
<set>
<string>
<unordered_map>
<unordered_set>
<vector>
|
201811
|
[P1209R0] Adopt Consistent Container Erasure from Library Fundamentals 2 for C++20 |
202002
|
[P1115R3] Improving the Return Value of Erase-Like Algorithms II: Free erase/erase_if | ||
__cpp_lib_exchange_function
|
<utility>
|
201304
|
[N3668]
exchange()
utility function, revision 3
|
__cpp_lib_execution
|
<execution>
|
201603
|
[P0024R2] The Parallelism TS Should be Standardized |
201902
|
[P1001R2] Target Vectorization Policies from Parallelism V2 TS to C++20 | ||
__cpp_lib_expected
|
<expected>
|
202202
|
[P0323R12] std::expected |
202211
|
[P2505R5] Monadic Functions for std::expected | ||
__cpp_lib_filesystem
|
<filesystem>
|
201603
|
[P0218R1] Adopt File System TS for C++17 |
201606
|
[P0219R1] Relative Paths for Filesystem
[P0392R0] Adapting string_view by filesystem paths |
||
201703
|
[P0317R1] Directory Entry Caching for Filesystem | ||
__cpp_lib_flat_map
|
<flat_map>
|
202207
|
[P0429R9] A Standard flat_map |
__cpp_lib_flat_set
|
<flat_set>
|
202207
|
[P1222R4] A Standard flat_set [LWG3751] Missing feature macro for flat_set |
__cpp_lib_format
|
<format>
|
201907
|
[P0645R10] Text Formatting [P1361R2] Integration of chrono with text formatting [P1652R1] Printf corner cases in std::format |
202106
|
[P2216R3] std::format improvements | ||
202110
|
[P2372R3] Fixing locale handling in
chrono formatters [P2418R2] Add support for std::generator-like types to std::format |
||
202207
|
[P2419R2] Clarify handling of encodings
in localized formatting of chrono types [P2508R1] Exposing std::basic-format-string |
||
202304
|
[P2510R3] Formatting pointers | ||
202305
|
[P2757R3] Type checking format args | ||
202306
|
[P2637R3] Member visit | ||
202311
|
[P2918R2] Runtime format strings II | ||
__cpp_lib_format_path
|
<filesystem>
|
202403
|
[P2845R8] Formatting of std::filesystem::path |
__cpp_lib_format_ranges
|
<format>
|
202207
|
[P2286R8] Formatting Ranges [P2585R1] Improving default container formatting [LWG3750] Too many papers bump __cpp_lib_format |
__cpp_lib_format_uchar
|
<format>
|
202311
|
[P2909R4] Fix formatting of code units as integers (Dude, where’s my char?) |
__cpp_lib_forward_like
|
<utility>
|
202207
|
[P2445R1] forward_like |
__cpp_lib_freestanding_algorithm
|
<algorithm>
|
202311
|
[P2407R5] Freestanding Library: Partial Classes |
__cpp_lib_freestanding_array
|
<array>
|
202311
|
[P2407R5] Freestanding Library: Partial Classes |
__cpp_lib_freestanding_char_traits
|
<string>
|
202306
|
[P2338R4] Freestanding Library: Character primitives and the C library |
__cpp_lib_freestanding_charconv
|
<charconv>
|
202306
|
[P2338R4] Freestanding Library: Character primitives and the C library |
__cpp_lib_freestanding_cstdlib
|
<cmath>
<cstdlib>
|
202306
|
[P2338R4] Freestanding Library: Character primitives and the C library |
__cpp_lib_freestanding_cstring
|
<cstring>
|
202306
|
[P2338R4] Freestanding Library: Character primitives and the C library |
202311
|
[P2937R0] Freestanding: Remove strtok | ||
__cpp_lib_freestanding_cwchar
|
<cwchar>
|
202306
|
[P2338R4] Freestanding Library: Character primitives and the C library |
__cpp_lib_freestanding_errc
|
<cerrno>
<system_error>
|
202306
|
[P2338R4] Freestanding Library: Character primitives and the C library |
__cpp_lib_freestanding_expected
|
<expected>
|
202311
|
[P2833R2] Freestanding Library: inout expected span |
__cpp_lib_freestanding_feature_test_macros
|
202306
|
[P2198R7] Freestanding Feature-Test Macros and Implementation-Defined Extensions | |
__cpp_lib_freestanding_functional
|
<functional>
|
202306
|
[P2198R7] Freestanding Feature-Test Macros and Implementation-Defined Extensions |
__cpp_lib_freestanding_iterator
|
<iterator>
|
202306
|
[P2198R7] Freestanding Feature-Test Macros and Implementation-Defined Extensions |
__cpp_lib_freestanding_mdspan
|
<mdspan>
|
202311
|
[P2833R2] Freestanding Library: inout expected span |
__cpp_lib_freestanding_memory
|
<memory>
|
202306
|
[P2198R7] Freestanding Feature-Test Macros and Implementation-Defined Extensions |
__cpp_lib_freestanding_operator_new
|
<operator_new>
|
202306
|
[P2198R7] Freestanding Feature-Test Macros and Implementation-Defined Extensions |
__cpp_lib_freestanding_optional
|
<optional>
|
202311
|
[P2407R5] Freestanding Library: Partial Classes |
__cpp_lib_freestanding_ranges
|
<ranges>
|
202306
|
[P2198R7] Freestanding Feature-Test Macros and Implementation-Defined Extensions |
__cpp_lib_freestanding_ratio
|
<ratio>
|
202306
|
[P2198R7] Freestanding Feature-Test Macros and Implementation-Defined Extensions |
__cpp_lib_freestanding_string_view
|
<string_view>
|
202311
|
[P2407R5] Freestanding Library: Partial Classes |
__cpp_lib_freestanding_tuple
|
<tuple>
|
202306
|
[P2198R7] Freestanding Feature-Test Macros and Implementation-Defined Extensions |
__cpp_lib_freestanding_utility
|
<utility>
|
202306
|
[P2198R7] Freestanding Feature-Test Macros and Implementation-Defined Extensions |
__cpp_lib_freestanding_variant
|
<variant>
|
202311
|
[P2407R5] Freestanding Library: Partial Classes |
__cpp_lib_fstream_native_handle
|
<fstream>
|
202306
|
[P1759R6] Native handles and file streams |
__cpp_lib_function_ref
|
<functional>
|
202306
|
[P0792R14] function_ref: a non-owning reference to a Callable |
__cpp_lib_gcd_lcm
|
<numeric>
|
201606
|
[P0295R0] Adopt Selected Library Fundamentals V2 Components for C++17 |
__cpp_lib_generate_random
|
<random>
|
202403
|
[P1068R11] Vector API for random number generation |
__cpp_lib_generator
|
<generator>
|
202207
|
[P2502R2] std::generator: Synchronous Coroutine Generator for Ranges |
__cpp_lib_generic_associative_lookup
|
<map>
<set>
|
201304
|
[N3657] Adding heterogeneous comparison lookup to associative containers (rev 4) |
__cpp_lib_generic_unordered_hash_lookup
|
<unordered_map>
<unordered_set> |
201902
|
[P0920R2] Precalculated hash values in lookup |
|
[P1661R1] Remove dedicated precalculated hash lookup interface | ||
__cpp_lib_generic_unordered_lookup
|
<unordered_map>
<unordered_set>
|
201811
|
[P0919R3] Heterogeneous lookup for unordered containers |
__cpp_lib_hardware_interference_size
|
<new>
|
201703
|
[P0154R1] constexpr std::thread::hardware_{true,false}_sharing_size
|
__cpp_lib_has_unique_object_representations
|
<type_traits>
|
201606
|
[P0258R2] has_unique_object_representations - wording |
__cpp_lib_hazard_pointer
|
<hazard_pointer>
|
202306
|
[P2545R4] Read-Copy Update (RCU) |
__cpp_lib_hypot
|
<cmath>
|
201603
|
[P0030R1] Proposal to Introduce a 3-Argument Overload to std::hypot |
__cpp_lib_incomplete_container_elements
|
<forward_list>
<list>
<vector>
|
201505
|
[N4510] Minimal incomplete type support for standard containers, revision 4 |
__cpp_lib_int_pow2
|
<bit>
|
201806
|
[P0556R3] Integral power-of-2 operations |
202002
|
[P1956R1] On the naming of low-level bit manipulation functions | ||
__cpp_lib_integer_comparison_functions
|
<utility>
|
202002
|
[P0586R2] Safe integral comparisons |
__cpp_lib_integer_sequence
|
<utility>
|
201304
|
[N3658] Compile-time integer sequences |
__cpp_lib_integral_constant_callable
|
<type_traits>
|
201304
|
[N3545] An
Incremental Improvement to
integral_constant
|
__cpp_lib_interpolate
|
<cmath>
<numeric>
|
201902
|
[P0811R3] Well-behaved interpolation for numbers and pointers |
__cpp_lib_invoke
|
<functional>
|
201411
|
[N4169] A
proposal to add invoke function
template (Revision 1)
|
__cpp_lib_invoke_r
|
<functional>
|
202106
|
[P2136R3] invoke_r |
__cpp_lib_ios_noreplace
|
<ios>
|
202207
|
[P2467R1] Support exclusive mode for fstreams |
__cpp_lib_is_aggregate
|
<type_traits>
|
201703
|
[LWG2911] An
is_aggregate type trait is needed
|
__cpp_lib_is_constant_evaluated
|
<type_traits>
|
201811
|
[P0595R2] std::is_constant_evaluated
|
__cpp_lib_is_final
|
<type_traits>
|
201402
|
[LWG2112] User-defined classes that cannot be derived from |
__cpp_lib_is_implicit_lifetime
|
<type_traits>
|
202302
|
[P2674R1] A trait for implicit lifetime types |
__cpp_lib_is_invocable
|
<type_traits>
|
201703
|
[P0604R0] Resolving GB 55, US 84, US 85, US 86 |
__cpp_lib_is_layout_compatible
|
<type_traits>
|
201907
|
[P0466R5] Layout-compatibility and Pointer-interconvertibility Traits |
__cpp_lib_is_nothrow_convertible
|
<type_traits>
|
201806
|
[P0758R1] Implicit conversion traits and
utility functions [LWG3356] __cpp_lib_nothrow_convertible should be __cpp_lib_is_nothrow_convertible |
__cpp_lib_is_null_pointer
|
<type_traits>
|
201309
|
[LWG2247] Type traits and std::nullptr_t
|
__cpp_lib_is_pointer_interconvertible
|
<type_traits>
|
201907
|
[P0466R5] Layout-compatibility and Pointer-interconvertibility Traits |
__cpp_lib_is_scoped_enum
|
<type_traits>
|
202011
|
[P1048R1] A proposal for a type trait to detect scoped enumerations |
__cpp_lib_is_swappable
|
<type_traits>
|
201603
|
[P0185R1] Adding [nothrow-]swappable traits, revision 3 |
__cpp_lib_is_within_lifetime
|
<type_traits>
|
202306
|
[P2641R4] Checking if a union alternative is active |
__cpp_lib_jthread
|
<stop_token>
<thread>
|
201907
|
[P0660R10] Stop Token and Joining Thread |
201911
|
[P1869R1] Rename ‘condition_variable_any’ interruptible wait methods | ||
__cpp_lib_latch
|
<latch>
|
201907
|
[P1135R6] The C++20 Synchronization Library |
__cpp_lib_launder
|
<new>
|
201606
|
[P0137R1] Core Issue 1776: Replacement of class objects containing reference members |
__cpp_lib_linalg
|
<linalg>
|
202311
|
[P1673R13] A free function linear algebra interface based on the BLAS |
__cpp_lib_list_remove_return_type
|
<forward_list>
<list>
|
201806
|
[P0646R1] Improving the Return Value of Erase-Like Algorithms I: list/forward list |
__cpp_lib_logical_traits
|
<type_traits>
|
201510
|
[P0013R1] Logical Operator Type Traits (revison 1) |
__cpp_lib_make_from_tuple
|
<tuple>
|
201606
|
[P0209R2]
make_from_tuple : apply for
construction
|
__cpp_lib_make_reverse_iterator
|
<iterator>
|
201402
|
[LWG2285]
make_reverse_iterator
|
__cpp_lib_make_unique
|
<memory>
|
201304
|
[N3656]
make_unique (Revision 1)
|
__cpp_lib_map_try_emplace
|
<map>
|
201411
|
[N4279] Improved insertion interface for unique-key maps (Revision 2.3) |
__cpp_lib_math_constants
|
<numbers>
|
201907
|
[P0631R8] Math Constants |
__cpp_lib_math_special_functions
|
<cmath>
|
201603
|
[P0226R1] Mathematical Special Functions for C++17, v5 |
__cpp_lib_mdspan
|
<mdspan>
|
202207
|
[P0009R18] MDSPAN [P2599R2] index _type & size_type in mdspan [P2604R0] MDSPAN: rename pointer and contiguous [P2613R1] Add the missing empty to
mdspan
|
__cpp_lib_memory_resource
|
<memory_resource>
|
201603
|
[P0220R1] Adopt Library Fundamentals V1 TS Components for C++17 (R1) |
__cpp_lib_modules
|
202207
|
[P2465R3] Standard Library Modules std and std.compat | |
__cpp_lib_monadic_optional
|
<optional>
|
202110
|
[P0798R8] Monadic operations for std::optional |
|
[LWG3621] Remove feature-test macro __cpp_lib_monadic_optional | ||
__cpp_lib_move_iterator_concept
|
<iterator>
|
202207
|
[P2520R0] move_iterator should be a random access iterator |
__cpp_lib_move_only_function
|
<functional>
|
202110
|
[P0288R9] move_only_function (was any_invocable) |
__cpp_lib_node_extract
|
<map>
<set>
<unordered_map>
<unordered_set>
|
201606
|
[P0083R3] Splicing Maps and Sets (Revision 5) |
__cpp_lib_nonmember_container_access
|
<array>
<deque>
<forward_list>
<iterator>
<list>
<map>
<regex>
<set>
<string>
<unordered_map>
<unordered_set>
<vector>
|
201411
|
[N4280] Non-member size() and more (Revison 2) |
__cpp_lib_not_fn
|
<functional>
|
201603
|
[P0005R4] Adopt
not_fn from Library Fundamentals 2
for C++17
|
202306
|
[P2714R1] Bind front and back to NTTP callables | ||
__cpp_lib_null_iterators
|
<iterator>
|
201304
|
[N3644] Null Forward Iterators |
__cpp_lib_optional
|
<optional>
|
201603
|
[P0220R1] Adopt Library Fundamentals V1 TS Components for C++17 (R1) |
201606
|
[P0032R3] Homogeneous interface for
variant, any and optional (Revision 3) [P0307R2] Making Optional Greater Equal Again |
||
202106
|
[P2231R1] Add further constexpr support for optional/variant | ||
202110
|
[P0798R8] Monadic operations for
std::optional [LWG3621] Remove feature-test macro __cpp_lib_monadic_optional |
||
__cpp_lib_out_ptr
|
<memory>
|
202106
|
[P1132R7] out_ptr - a scalable output pointer abstraction |
202311
|
[P2833R2] Freestanding Library: inout expected span | ||
__cpp_lib_parallel_algorithm
|
<algorithm>
<numeric>
|
201603
|
[P0024R2] The Parallelism TS Should be Standardized |
__cpp_lib_polymorphic_allocator
|
<memory_resource>
|
201902
|
[P0339R6] polymorphic_allocator<>
as a vocabulary type [LWG3437] __cpp_lib_polymorphic_allocator is in the wrong header |
__cpp_lib_print
|
<ostream>
<print>
|
202207
|
[P2093R14] Formatted output |
202403
|
[P3107R5] Permit an efficient implementation of std::print | ||
__cpp_lib_quoted_string_io
|
<iomanip>
|
201304
|
[N3654] Quoted Strings Library Proposal (Revision 2) |
__cpp_lib_ranges
|
<algorithm>
<functional>
<iterator>
<memory>
<ranges>
|
201811
|
[P0896R4] The One Ranges Proposal |
201907
|
[P1035R7] Input Range Adaptors | ||
201911
|
[P1716R3] ranges compare algorithm are over-constrained | ||
202106
|
[P2325R3] Views should not be required to be default constructible | ||
202110
|
[P2415R2] What is a view? | ||
202202
|
[P2387R3] Pipe support for user-defined range adaptors | ||
202207
|
[P2494R2] Relaxing range adaptors to allow for move only types | ||
202211
|
[P2602R2] Poison Pills are Too Toxic | ||
202302
|
[P2609R3] Relaxing Ranges Just A Smidge | ||
__cpp_lib_ranges_as_const
|
<ranges>
|
202207
|
[P2278R4] cbegin should always return a constant iterator |
202311
|
[P2836R1] std::basic_const_iterator should follow its underlying type’s convertibility | ||
__cpp_lib_ranges_as_rvalue
|
<ranges>
|
202207
|
[P2446R2] views::as_rvalue |
__cpp_lib_ranges_cartesian_product
|
<ranges>
|
202207
|
[P2374R4] views::cartesian_product
[P2540R1] Empty Product for certain Views |
__cpp_lib_ranges_chunk
|
<ranges>
|
202202
|
[P2442R1] Windowing range adaptors: views::chunk and views::slide |
__cpp_lib_ranges_chunk_by
|
<ranges>
|
202202
|
[P2443R1] views::chunk_by |
__cpp_lib_ranges_concat
|
<ranges>
|
202403
|
[P2542R8] views::concat |
__cpp_lib_ranges_contains
|
<algorithm>
|
202207
|
[P2302R4] std::ranges::contains |
__cpp_lib_ranges_enumerate
|
<ranges>
|
202302
|
[P2164R9] views::enumerate |
__cpp_lib_ranges_find_last
|
<algorithm>
|
202207
|
[P1223R5] find_last [LWG3807] The feature test macro for ranges::find_last should be renamed |
__cpp_lib_ranges_fold
|
<algorithm>
|
202207
|
[P2322R6] ranges::fold |
__cpp_lib_ranges_iota
|
<numeric>
|
202202
|
[P2440R1] ranges::iota, ranges::shift_left, and ranges::shift_right |
__cpp_lib_ranges_join_with
|
<ranges>
|
202202
|
[P2441R2] views::join_with |
__cpp_lib_ranges_repeat
|
<ranges>
|
202207
|
[P2474R2] views::repeat |
__cpp_lib_ranges_slide
|
<ranges>
|
202202
|
[P2442R1] Windowing range adaptors: views::chunk and views::slide |
__cpp_lib_ranges_starts_ends_with
|
<algorithm>
|
202106
|
[P1659R3] starts_with and ends_with |
__cpp_lib_ranges_stride
|
<ranges>
|
202207
|
[P1899R3] stride_view |
__cpp_lib_ranges_to_container
|
<ranges>
|
202202
|
[P1206R7] Conversions from ranges to containers |
__cpp_lib_ranges_zip
|
<ranges>
<tuple>
<utility>
|
202110
|
[P2321R2] zip |
__cpp_lib_ratio
|
<ratio>
|
202306
|
[P2734R0] Adding the new 2022 SI prefixes |
__cpp_lib_raw_memory_algorithms
|
<memory>
|
201606
|
[P0040R3] Extending memory management tools |
__cpp_lib_rcu
|
<rcu>
|
202306
|
[P2545R4] Read-Copy Update (RCU) |
__cpp_lib_reference_from_temporary
|
<type_traits>
|
202202
|
[P2255R2] A type trait to detect reference binding to temporary |
__cpp_lib_reference_wrapper
|
<functional>
|
202403
|
[P2944R3] Comparisons for reference_wrapper |
__cpp_lib_remove_cvref
|
<type_traits>
|
201711
|
[P0550R2] Transformation Trait remove_cvref |
__cpp_lib_result_of_sfinae
|
<functional>
<type_traits>
|
201210
|
[N3462]
std::result_of and
SFINAE
|
__cpp_lib_robust_nonmodifying_seq_ops
|
<algorithm>
|
201304
|
[N3671] Making non-modifying sequence operations more robust: Revision 2 |
__cpp_lib_sample
|
<algorithm>
|
201603
|
[P0220R1] Adopt Library Fundamentals V1 TS Components for C++17 (R1) |
__cpp_lib_saturation_arithmetic
|
<numeric>
|
202311
|
[P0543R3] Saturation arithmetic |
__cpp_lib_scoped_lock
|
<mutex>
|
201703
|
[P0156R2] Variadic
lock_guard (Rev. 4)
|
__cpp_lib_semaphore
|
<semaphore>
|
201907
|
[P1135R6] The C++20 Synchronization Library |
<shared_mutex>
|
201505
|
[N4508] A proposal to add shared_mutex (untimed) (Revision 4) | |
<memory>
|
201611
|
[P0497R0] Fixes to shared_ptr support for arrays | |
201707
|
[P0674R1] Extending make_shared to Support Arrays | ||
<memory>
|
201606
|
[P0163R0] shared_ptr::weak_type
|
|
<shared_mutex>
|
201402
|
[N3891] A
proposal to rename shared_mutex to
shared_timed_mutex
|
|
__cpp_lib_shift
|
<algorithm>
|
201806
|
[P0769R2] Add shift to <algorithm>
|
202202
|
[P2440R1] ranges::iota, ranges::shift_left, and ranges::shift_right | ||
__cpp_lib_smart_pointer_owner_equality
|
<memory>
|
202306
|
[P1901R2] Enabling the Use of weak_ptr as Keys in Unordered Associative Containers |
__cpp_lib_smart_ptr_for_overwrite
|
<memory>
|
202002
|
[P1020R1] Smart pointer creation with
default initialization [P1973R1] Rename _default_init functions (NB Comment DE002) |
__cpp_lib_source_location
|
<source_location>
|
201907
|
[P1208R6] Adopt source location from Library Fundamentals V3 for C++20 |
__cpp_lib_span
|
<span>
|
201803
|
[P0122R7] span: bounds-safe views for
sequences of objects [LWG3274] Missing feature test macro for <span>
|
201902
|
[P1024R3] Usability Enhancements for
std::span
|
||
202002
|
[P1976R2] Fixed-size
span construction from dynamic range
|
||
202311
|
[P2821R5] span.at() [P2833R2] Freestanding Library: inout expected span |
||
__cpp_lib_span_initializer_list
|
<span>
|
202311
|
[P2447R6] std::span over an initializer list |
__cpp_lib_spanstream
|
<spanstream>
|
202106
|
[P0448R4] A strstream replacement using span as buffer |
__cpp_lib_ssize
|
<iterator>
|
201902
|
[P1227R2] Signed ssize() functions, unsigned size() functions |
__cpp_lib_sstream_from_string_view
|
<sstream>
|
202306
|
[P2495R3] Interfacing stringstreams with string_view |
__cpp_lib_stacktrace
|
<stacktrace>
|
202011
|
[P0881R7] A Proposal to add stacktrace library |
__cpp_lib_start_lifetime_as
|
<memory>
|
202207
|
[P2590R2] Explicit lifetime management |
__cpp_lib_starts_ends_with
|
<string>
<string_view>
|
201711
|
[P0457R2] String Prefix and Suffix Checking |
__cpp_lib_stdatomic_h
|
<stdatomic.h>
|
202011
|
[P0943R6] Support C atomics in C++ |
__cpp_lib_string_contains
|
<string>
<string_view>
|
202011
|
[P1679R3] String Contains function |
__cpp_lib_string_resize_and_overwrite
|
<string>
|
202110
|
[P1072R10] basic_string::resize_and_overwrite |
__cpp_lib_string_udls
|
<string>
|
201304
|
[N3642] User-defined Literals for Standard Library Types (part 1 - version 4) |
__cpp_lib_string_view
|
<string>
<string_view>
|
201603
|
[P0220R1] Adopt Library Fundamentals V1 TS Components for C++17 (R1) |
201606
|
[P0254R2] Integrating std::string_view
and
std::string
|
||
201803
|
[P0858R0] Constexpr iterator requirements
[LWG3257] Missing feature testing macro update from P0858 |
||
202403
|
[P2591R5] Concatenation of strings and string views | ||
__cpp_lib_submdspan
|
<mdspan>
|
202306
|
[P2630R4] Submdspan |
202403
|
[P2642R6] Padded mdspan layouts | ||
__cpp_lib_syncbuf
|
<syncstream>
|
201711
|
[P0053R7] C++ Synchronized Buffered Ostream |
201803
|
[P0753R2] Manipulators for C++ Synchronized Buffered Ostream | ||
__cpp_lib_text_encoding
|
<text_encoding>
|
202306
|
[P1885R12] Naming Text Encodings to Demystify Them |
__cpp_lib_three_way_comparison
|
<compare>
|
201711
|
[P0768R1] Library Support for the Spaceship (Comparison) Operator |
201907
|
[P1614R2] The Mothership Has Landed:
Adding
<=> to
the Library
|
||
__cpp_lib_to_address
|
<memory>
|
201711
|
[P0653R2] Utility to convert a pointer to a raw pointer |
__cpp_lib_to_array
|
<array>
|
201907
|
[P0325R4] to_array from LFTS with updates |
__cpp_lib_to_chars
|
<charconv>
|
201611
|
[P0067R5] Elementary string conversions,
revision 5 [P0682R1] Repairing elementary string conversions [LWG3137] Header for __cpp_lib_to_chars
|
202306
|
[P2497R0] Testing for success or failure of charconv functions | ||
__cpp_lib_to_string
|
<string>
|
202306
|
[P2587R3] to_string or not to_string |
__cpp_lib_to_underlying
|
<utility>
|
202102
|
[P1682R2] std::to_underlying |
__cpp_lib_transformation_trait_aliases
|
<type_traits>
|
201304
|
[N3655] TransformationTraits Redux, v2 |
__cpp_lib_transparent_operators
|
<functional>
<memory>
|
201210
|
[N3421]
Making Operator Functors greater<>
|
201510
|
[P0074R0] Making std::owner_less
more flexible
|
||
__cpp_lib_tuple_element_t
|
<tuple>
|
201402
|
[N3887] Consistent Metafunction Aliases |
__cpp_lib_tuple_like
|
<map>
<tuple>
<unordered_map>
<utility>
|
202207
|
[P2165R4] Compatibility between tuple, pair and tuple-like objects |
202311
|
[P2819R2] Add tuple protocol to complex | ||
__cpp_lib_tuples_by_type
|
<tuple>
<utility>
|
201304
|
[N3670] Wording for Addressing Tuples by Type: Revision 2 |
__cpp_lib_type_identity
|
<type_traits>
|
201806
|
[P0887R1] The identity metafunction |
__cpp_lib_type_trait_variable_templates
|
<type_traits>
|
201510
|
[P0006R0] Adopt Type Traits Variable Templates from Library Fundamentals TS for C++17 |
__cpp_lib_uncaught_exceptions
|
<exception>
|
201411
|
[N4259]
Wording for std::uncaught_exceptions
|
__cpp_lib_unordered_map_try_emplace
|
<unordered_map>
|
201411
|
[N4279] Improved insertion interface for unique-key maps (Revision 2.3) |
__cpp_lib_unreachable
|
<utility>
|
202202
|
[P0627R6] Function to mark unreachable code |
__cpp_lib_unwrap_ref
|
<type_traits>
|
201811
|
[P0318R1] unwrap_ref_decay and
unwrap_reference [LWG3348] __cpp_lib_unwrap_ref in wrong header |
__cpp_lib_variant
|
<variant>
|
201606
|
[P0088R3] Variant: a type-safe union for
C++17 (v8) [P0393R3] Making Variant Greater Equal [P0032R3] Homogeneous interface for variant, any and optional (Revision 3) |
202102
|
[P2162R2] Inheriting from std::variant (resolving LWG3052) | ||
202106
|
[P2231R1] Add further constexpr support for optional/variant | ||
202306
|
[P2637R3] Member visit | ||
__cpp_lib_void_t
|
<type_traits>
|
201411
|
[N3911]
TransformationTrait Alias void_t
|