BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bsls_libraryfeatures

Detailed Description

Provide macros to identify native standard library features.

Outline

Purpose

Provide macros to identify native standard library features.

Classes

Macros

See also
bsls_platform, bsls_compilerfeatures

Description

This component provides a suite of preprocessor macros that indicate the availability of library-specific support of features that may not be available in all standard library versions in use across an organization. None of these macros will be defined unless the compiler is building with a tool-chain targeting at least experimental support for a more recent standard than C++03. For example, the C++11 standard library introduced several functions and types that were not available in libraries for earlier standards. The macro BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY can be used to conditionally compile BDE code depending on those functions when they are available, and exclude that code when those functions are not present, thereby allowing compilation by earlier tool-chains.

The standard library version described by these macros always corresponds to that used to build this component and is the source of the symbols found in the std namespace.

Guarding Against Mixing C++ Versions

This component defines a "link-coercion" symbol that prevents linking a translation unit (that includes this header, possibly indirectly) built against one version of the C++ Standard with a translation unit (also including this header) built against another version of the Standard. For example, attempting to link objects built with C++14 with those built with C++17 will result in a link-time failure. Because BDE supports a variety of features that are enabled depending on the C++ version for which code is built, it is generally not safe to link code built with one version of C++ with code built with another version. For example, in C++11 there are move constructor signatures, whereas in C++03 there are not, and linking code that views the set of constructors for a type differently is an ODR violation. The link-coercion symbol that enforces this is meant to provide users a single, easy-to-comprehend link-time error, rather than having bugs potentially manifest at runtime in ways that are difficult to diagnose.

Forcing Language ABI Compatibility

For open-source users, configuration macros are provided to enable ABI compatibility when compiling BDE between different language standards.

!WARNING! These configuration macros should NOT be used outside of recipes for open-source package managers like VCPKG. Code compiled with these macros will NOT be linkable against code compiled without them

BDE has it's own implementations for a number of types, like bsl::string_view, that when building with a newer language standard (e.g., C++20) will be an alias to the platform standard library (these are sometimes referred to as "polyfill" types). By default, BDE will make a selection between the platform implementation and the BDE implementation based on the language standard being used. However, that means that translation units (using BDE) that are compiled with different language standards are binary incompatible.

BDE provides the following macros for forcing ABI compatibility, to allow translation units compiled with different language standards to be linked together. These macros follow a pattern BSLS_LIBRARYFEATURES_FORCE_ABI_CPP##, where CPP## is a language standard (e.g., CPP11). Using *_ABI_CPP11, for example, forces ABI compatibility where the minimum supported compiler is C++11, so BDE implementations will be used for any standard library features that were introduced after C++11.

Attempts to combine these macros, or force ABI compatibility with a language standard newer than the current compiler will fail. Attempts to link translation units built with different force-ABI macros defined should fail (on platforms where bsls_linkcoercion is supported).

Also note that builds with C++03 are always binary incompatible with builds with other language standards because of the treatment of rvalue-references, and variadic functions, and variadic templates.

Finally, note that the current list of "polyfill" types BDE provides are:

Feature Minimum Language Version For Alias
span C++20
string_view C++20 [1]
array C++17 [1]
optional C++17
uncaught_exception C++17
reference_wrapper C++11 [2]
system_error C++11 [2]
  1. BDE uses its own implementations for some of the standard library features even when a (possibly incomplete) platform implementation is available to ensure that features are available when building with older language standards and/or compilers. E.g., we use the BDE implementation of string_view in C++17 to allow C++17 users to use the new methods introduced in C++20.
  2. These types are aliases to the matching platform standard library types, on all platforms where the forced-ABI compatibility macros are relevant.

Converse Logic Is Not Symmetric

The macros defined by this component describe features empirically observed in typical platform/compiler/library combinations used in BDE distributions. The definition of any of these macros implies that a resource is available, however, the converse is not guaranteed. If a macro is not defined, the associated resource may or may not exist in the library. For example, the resource may exist but may be of too early an implementation to be of use to clients of BDE, so in that case the associated macro would not be defined.

BSLS_LIBRARYFEATURES_HAS_C90_GETS

The BSLS_LIBRARYFEATURES_HAS_C90_GETS macro is defined if the gets function (defined in <cstdio>) is provided in namespace std by the native standard library. This dangerous function is removed from the C++14 standard library, and its use with earlier dialects is strongly discouraged.

BSLS_LIBRARYFEATURES_HAS_C99_FP_CLASSIFY

The BSLS_LIBRARYFEATURES_HAS_C99_FP_CLASSIFY macro is defined if all of the listed floating-point classification functions, defined in the headers named below, are implemented by the native standard library in namespace std:

BSLS_LIBRARYFEATURES_HAS_C99_LIBRARY

The BSLS_LIBRARYFEATURES_HAS_C99_LIBRARY macro is defined if all of the listed functions and types, defined in the headers named below, are implemented by the native standard library in namespace std:

This macro is defined first for the following compiler versions:

Notice that the above list does not include snprintf as that is included in the separate BSLS_LIBRARYFEATURES_HAS_C99_SNPRINTF macro. Also note that AIX and Solaris compilers generally have implementations of these functions in the global namespace when including the corresponding C header, but do not provide the standard C++ mapping.

BSLS_LIBRARYFEATURES_HAS_C99_SNPRINTF

The BSLS_LIBRARYFEATURES_HAS_C99_SNPRINTF macro is defined if snprintf function (defined in <cstdio>) is implemented by the native standard library in namespace std.

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP98_AUTO_PTR

The BSLS_LIBRARYFEATURES_HAS_CPP98_AUTO_PTR macro is defined if the auto_ptr class template (defined in <memory>) is provided by the native standard library. This macro is expected to be defined for all libraries/platforms at least until the introduction of C++17 to our build systems.

BSLS_LIBRARYFEATURES_HAS_CPP98_BINDERS_API

The BSLS_LIBRARYFEATURES_HAS_CPP98_BINDERS_API macro is defined if the result_type, argument_type, first_argument_type and second_argument_type typedefs (defined in <functional>) are provided by the native standard library. This macro is expected to be defined for all libraries/platforms at least until the introduction of C++20 to our build systems.

BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY

The BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY macro is used to identify whether the current platform's standard library supports a baseline set of C++11 library features (which are defined below). This is especially important in BSL when importing standard library functions and types into the bsl:: namespace, as is done in bsl+bslhdrs. In particular this macro is used where C++11 has introduced new functions and types into headers available in older versions of the C++ standard. For example, C++11 introduced the type move_iterator to the existing <iterator> header, so bsl_iterator.h uses this macro to determine whether to import std::move_iterator into the bsl namespace.

This macro is defined if both of the listed conditions are true:

This macro is defined first for the following compiler versions:

Notice that the above list does not include random_shuffle as that is deprecated in C++14 and will be removed in C++17.

BSLS_LIBRARYFEATURES_HAS_CPP11_DYNAMIC_EXCEPTION_SPECS

The BSLS_LIBRARYFEATURES_HAS_CPP11_DYNAMIC_EXCEPTION_SPECS macro is defined if both of the listed conditions are true:

DEPRECATED: Do not use the API listed above.

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP11_EXCEPTION_HANDLING

The BSLS_LIBRARYFEATURES_HAS_CPP11_EXCEPTION_HANDLING macro is defined if both of the listed conditions are true:

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP11_GARBAGE_COLLECTION_API

The BSLS_LIBRARYFEATURES_HAS_CPP11_GARBAGE_COLLECTION_API macro is defined if both of the listed conditions are true:

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP11_MISCELLANEOUS_UTILITIES

The BSLS_LIBRARYFEATURES_HAS_CPP11_MISCELLANEOUS_UTILITIES macro is defined if both of the listed conditions are true:

This macro is defined first for the following compiler versions:

Notice that the function get_unexpected will be removed in C++17.

BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR

The BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR macro is defined if the pair class template (defined in <utility>) provided by the native library has a constructor with the signature:

template <class... Args1, class... Args2>
pair(piecewise_construct_t ,
tuple<Args1...> first_args,
tuple<Args2...> second_args);

Notice that the existence of the above constructor implies that each of the following conditions are also true:

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP11_PROGRAM_TERMINATION

The BSLS_LIBRARYFEATURES_HAS_CPP11_PROGRAM_TERMINATION macro is defined if of the listed conditions are true:

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP11_RANGE_FUNCTIONS

The BSLS_LIBRARYFEATURES_HAS_CPP11_RANGE_FUNCTIONS macro is defined if the following functions are provided by the native standard library in the <iterator> header:

template <class C> auto begin(C& c) -> decltype(c.begin());
template <class C> auto begin(const C& c) -> decltype(c.begin());
template <class C> auto end(C& c) -> decltype(c.end());
template <class C> auto end(const C& c) -> decltype(c.end());
template <class T, size_t N> T* begin(T (&array)[N]);
template <class T, size_t N> T* end(T (&array)[N]);

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP11_SHORT_STRING

The BSLS_LIBRARYFEATURES_HAS_CPP11_SHORT_STRING macro is defined if the standard library class template std::basic_string follows the revised contract of C++11 that essentially bans the copy-on-write optimization in favor of using the short string optimization. This ABI-breaking change was necessary for an efficient implementation under the C++11 memory model. Note that this feature macro is constrained not just by library version, but also by a library compatibility switch on some platforms. For example, Red Hat Enterprise Linux 7 and earlier enforce the use of the older C++98 string with the copy-on-write optimization.

BSLS_LIBRARYFEATURES_HAS_CPP11_STREAM_MOVE

The BSLS_LIBRARYFEATURES_HAS_CPP11_STREAM_MOVE macro is defined if the standard stream classes (basic_istream , basic_ostream , basic_stream ) all have the C++11 mandated move operations (constructor and assignment operator) defined. Notice that the this macro is separate from the macro BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY as standard library implementations exist that implement almost all of C++11 (which is detected by the BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY macro) but not this feature. Note that when BSLS_LIBRARYFEATURES_HAS_CPP11_STREAM_MOVE is defined BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES will also be defined, as the standard feature cannot be implemented without rvalue reference support from the compiler.

BSLS_LIBRARYFEATURES_HAS_CPP11_TUPLE

The BSLS_LIBRARYFEATURES_HAS_CPP11_TUPLE macro is defined if both of the listed conditions are true:

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP11_UNIQUE_PTR

The BSLS_LIBRARYFEATURES_HAS_CPP11_UNIQUE_PTR macro is defined if both of the listed conditions are true:

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP14_BASELINE_LIBRARY

The BSLS_LIBRARYFEATURES_HAS_CPP14_BASELINE_LIBRARY macro is used to identify whether the current platform's standard library supports a baseline set of C++14 library features (which are defined below). This is especially important in BSL when importing standard library functions and types into the bsl:: namespace, as is done in bsl+bslhdrs.

This macro is defined if all of the listed conditions are true:

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP14_INTEGER_SEQUENCE

The BSLS_LIBRARYFEATURES_HAS_CPP14_INTEGER_SEQUENCE macro is defined if all of the listed conditions are true:

The BDE feature macro BSLS_COMPILERFEATURES_FULL_CPP11 is also defined in the case that all of these conditions are met, and is often simpler to test for.

Note that though struct integer_sequence was introduced in the C++14 standard, bsl::integer_sequence is supported by BDE when compiling in C++11 mode.

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP14_RANGE_FUNCTIONS

The BSLS_LIBRARYFEATURES_HAS_CPP14_RANGE_FUNCTIONS macro is defined if the following functions are provided by the native standard library in the <iterator> header:

template <class C> auto cbegin(const C& c) -> decltype(std::begin(c));
template <class C> auto cend( const C& c) -> decltype(std::end(c));
template <class C> auto rbegin( C& c) -> decltype(c.rbegin());
template <class C> auto rbegin(const C& c) -> decltype(c.rbegin());
template <class C> auto rend( C& c) -> decltype(c.rend());
template <class C> auto rend(const C& c) -> decltype(c.rend());
template <class T, size_t N> reverse_iterator<T*> rbegin(T (&array)[N]);
template <class T, size_t N> reverse_iterator<T*> rend( T (&array)[N]);
template <class E> reverse_iterator<const E*> rbegin(initializer_list<E>);
template <class E> reverse_iterator<const E*> rend( initializer_list<E>);
template <class C> auto crbegin(const C& c) -> decltype(std::rbegin(c));
template <class C> auto crend( const C& c) -> decltype(std::rend(c));

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP17_ALIGNED_ALLOC

The BSLS_LIBRARYFEATURES_HAS_CPP17_ALIGNED_ALLOC macro is defined if the native standard library provides std::aligned_alloc.

Both libstdc++ and libc++ will provide this call if the underlying C library provides the global call ::aligned_alloc. This call is available on RedHat version 7, for example, but not on RedHat 6. Microsoft does not provide this call. See https://github.com/microsoft/STL/issues/2176

BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY

This macro is used to identify whether the current platform's standard library supports a baseline set of C++17 library features (which are defined below). This is especially important in BSL when importing standard library functions and types into the bsl:: namespace, as is done in bsl+bslhdrs.

This macro is defined if all of the listed conditions are true:

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP17_CHARCONV

The BSLS_LIBRARYFEATURES_HAS_CPP17_CHARCONV macro is defined if the native standard library provides the <charconv> header and implements all required content with no major issues. This macro is defined in addition to the BSLS_LIBRARYFEATURES_HAS_CPP17_INT_CHARCONV macro when the native standard library also implements the std::chars_format enumeration, and both std::from_chars and std::to_chars functions for all 3 standard floating point types (float, double, long double).

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP17_DEPRECATED_REMOVED

The BSLS_LIBRARYFEATURES_HAS_CPP17_DEPRECATED_REMOVED macro is defined for libraries that do not export names removed in C++17, such as std::ptr_fun. BSLS_LIBRARYFEATURES_HAS_CPP17_DEPRECATED_REMOVED is generally the negation of BSLS_LIBRARYFEATURES_HAS_CPP98_AUTO_PTR. Although the removal of deprecated C++17 types is conceptually equivalent to __cplusplus >= 201703L, standard library implementations often provide configuration flags to expose the deprecated library features.

BSLS_LIBRARYFEATURES_HAS_CPP17_FILESYSTEM

The BSLS_LIBRARYFEATURES_HAS_CPP17_FILESYSTEM macro is defined if the native standard library provides the <filesystem> header and implements all required content with no major issues.

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP17_INT_CHARCONV

The BSLS_LIBRARYFEATURES_HAS_CPP17_INT_CHARCONV macro is defined if the native standard library provides the <charconv> header and implements both std::from_chars and std::to_chars for all standard signed and unsigned integer types and the char type, as well as the std::to_chars_result and std::from_chars_result types.

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP17_PARALLEL_ALGORITHMS

The BSLS_LIBRARYFEATURES_HAS_CPP17_PARALLEL_ALGORITHMS macro is defined if the native standard library provides the <execution> header and implements all the parallel algorithm overloads in the <algorithm> and <numeric> headers with no major issues.

BSLS_LIBRARYFEATURES_HAS_CPP17_PMR

The BSLS_LIBRARYFEATURES_HAS_CPP17_PMR macro is defined if the native standard library provides the <memory_resource> header and implements all required content with no major issues.

This macro is defined first for the following stdlib versions:

BSLS_LIBRARYFEATURES_HAS_CPP17_PMR_STRING

The BSLS_LIBRARYFEATURES_HAS_CPP17_PMR_STRING macro is defined if the native standard library provides the pmr::basic_string class template with no major issues.

Usually pmr::string is available if the PMR feature is available. But GNU libstdc++ does not provide it for the obsolete pre-C++11 CoW string implemetation (_GLIBCXX_USE_CXX11_ABI == 0).

BSLS_LIBRARYFEATURES_HAS_CPP17_PRECISE_BITWIDTH_ATOMICS

The BSLS_LIBRARYFEATURES_HAS_CPP17_PRECISE_BITWIDTH_ATOMICS macro is defined if both of the listed conditions are true: defined if the <atomic> header provided by the native standard library provides type aliases for all of the following precise bit-width atomic types:

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP17_RANGE_FUNCTIONS

The BSLS_LIBRARYFEATURES_HAS_CPP17_RANGE_FUNCTIONS macro is defined if the following functions are provided by the native standard library in the <iterator> header:

template <class C> auto empty(const C& c) -> decltype(c.empty());
template <class C> auto data( const C& c) -> decltype(c.data());
template <class C> auto size( const C& c) -> decltype(c.size());

BSLS_LIBRARYFEATURES_HAS_CPP17_SEARCH_FUNCTORS

The BSLS_LIBRARYFEATURES_HAS_CPP17_SEARCH_FUNCTORS macro is defined if the native library supplies the following class templates in <functional>:

Currently the following compilers define this function template in C++17 or later modes:

BSLS_LIBRARYFEATURES_HAS_CPP17_SEARCH_OVERLOAD

The BSLS_LIBRARYFEATURES_HAS_CPP17_SEARCH_OVERLOAD macro is defined if <algorithm> defines an overload for the search function template that accepts instances of the searcher classes introduced in C++17. See [alg.search]:

template<class ForwardIterator, class Searcher>
constexpr ForwardIterator std::search(ForwardIterator first,
ForwardIterator last,
const Searcher& searcher);

Currently the following compilers define this function template in C++17 or later modes:

BSLS_LIBRARYFEATURES_HAS_CPP17_SPECIAL_MATH_FUNCTIONS

The BSLS_LIBRARYFEATURES_HAS_CPP17_SPECIAL_MATH_FUNCTIONS macro is defined if the special math functions such as std::assoc_laguerre, std::beta and others are provided by the native standard library in the <cmath> header.

BSLS_LIBRARYFEATURES_HAS_CPP17_TIMESPEC_GET

The BSLS_LIBRARYFEATURES_HAS_CPP17_TIMESPEC_GET macro is defined if the native standard library provides std::timespec_get.

Both libstdc++ and libc++ will provide this call if the underlying C library provides the global call ::timespec_get. This call is available on RedHat version 7, for example, but not on RedHat 6.

BSLS_LIBRARYFEATURES_HAS_CPP20_ATOMIC_FLAG_TEST_FREE_FUNCTIONS

The BSLS_LIBRARYFEATURES_HAS_CPP20_ATOMIC_FLAG_TEST_FREE_FUNCTIONS is defined if the bsl::atomic_flag_test and bsl::atomic_flag_test_explicit functions are available with C++20 semantics.

This macro is defined if the standard __cpp_lib_atomic_flag_test feature-test macro is defined and has a value of at least 201907L.

This macro is defined first for the following compiler versions:

(no current version of GCC supports this feature)

BSLS_LIBRARYFEATURES_HAS_CPP20_ATOMIC_LOCK_FREE_TYPE_ALIASES

The BSLS_LIBRARYFEATURES_HAS_CPP20_ATOMIC_LOCK_FREE_TYPE_ALIASES macro is defined if bsl::atomic_signed_lock_free and bsl:atomic_unsigned_lock_free types are available with C++20 semantics.

This macro is defined if the standard __cpp_lib_atomic_lock_free_type_aliases feature-test macro is defined.

This macro is defined first for the following compiler versions:

(no curent version of clang supports this feature)

BSLS_LIBRARYFEATURES_HAS_CPP20_ATOMIC_REF

The BSLS_LIBRARYFEATURES_HAS_CPP20_ATOMIC_REF macro is defined if the bsl::atomic_ref type is available with C++20 semantics.

This macro is defined if the standard __cpp_lib_atomic_ref feature-test macro is defined and __cpp_lib_atomic_ref >= 201806L.

This macro is defined first for the following compiler versions:

(no current version of libc++ supports this feature)

BSLS_LIBRARYFEATURES_HAS_CPP20_ATOMIC_WAIT_FREE_FUNCTIONS

The BSLS_LIBRARYFEATURES_HAS_CPP20_ATOMIC_WAIT_FREE_FUNCTIONS macro is defined if the following free functions are available: bsl::atomic_flag_wait, bsl::atomic_flag_wait_explicit, bsl::atomic_flag_notify_one, bsl::atomic_flag_notify_all with C++20 semantics.

This macro is defined if the standard __cpp_lib_atomic_wait feature-test macro is defined and has a value of at least 201907L.

This macro is defined first for the following compiler versions:

(no current version of GCC supports this feature)

BSLS_LIBRARYFEATURES_HAS_CPP20_BASELINE_LIBRARY

This macro is used to identify whether the current platform's standard library supports a baseline set of C++20 library features (which are defined below). This is especially important in BSL when importing standard library functions and types into the bsl:: namespace, as is done in bsl+bslhdrs.

This macro is defined if all of the listed conditions are true:

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP20_CALENDAR

The BSLS_LIBRARYFEATURES_HAS_CPP20_CALENDAR macro is defined if the C++20 calendar/TZ features, except those guarded by the BSLS_LIBRARYFEATURES_HAS_CPP20_TIMEZONE macro, are available in bsl::chrono namespace.

This macro is defined if the standard __cpp_lib_chrono feature-test macro has at least 201907L value.

This feature has been provided by MSVC++ compiler since VS 2019 16.10. But that release was shipped with the following important note: "While the STL generally provides all features on all supported versions of Windows, leap seconds and time zones (which change over time) require OS support that was added to Windows 10. Specifically, updating the leap second database requires Windows 10 version 1809 or later, and time zones require <tt>icu.dll</tt> which is provided by Windows 10 version 1903/19H1 or later. This applies to both client and server OSes; note that Windows Server 2019 is based on Windows 10 version 1809." If the feature is used on a host that does not provide `icu.dll`, an exception with "The specified module could not be found." message will be thrown. For this reason those features are disabled by default on Windows.

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP20_CHAR8_MB_CONV

The BSLS_LIBRARYFEATURES_HAS_CPP20_CHAR8_MB_CONV macro is defined if the bsl::mbrtoc8 and bsl::c8rtomb functions are available with C++20 semantics.

(no current version of GCC, clang or MSVC supports this feature)

BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS

The BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS macro is defined if the native standard library provides the <concepts> header and implements all required content with no major issues.

This macro is defined if the standard __cpp_lib_concepts feature-test macro is defined and __cpp_lib_concepts >= 202002L.

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP20_DEPRECATED_REMOVED

The BSLS_LIBRARYFEATURES_HAS_CPP20_DEPRECATED_REMOVED macro is defined for libraries that do not export names removed in C++20, such as std::uncaught_exception. Although the removal of deprecated C++20 types is conceptually equivalent to __cplusplus >= 202002L, some standard library implementations may continue to expose the features, and some may provide configuration flags to expose the deprecated library features.

BSLS_LIBRARYFEATURES_HAS_CPP20_FORMAT

BSLS_LIBRARYFEATURES_HAS_CPP20_FORMAT macro is defined if the <format> header is available and supports P2216 and P2372 (which were defect reports against C++20).

This macro is defined first for the following compiler versions:

(*) Up to libc++ 20.10 there is a bug with character arrays https://github.com/llvm/llvm-project/issues/115935

BSLS_LIBRARYFEATURES_HAS_CPP20_IS_CORRESPONDING_MEMBER

The BSLS_LIBRARYFEATURES_HAS_CPP20_IS_CORRESPONDING_MEMBER macro is defined if the bsl::is_corresponding_member meta function is available.

Note that the standard feature test macro __cpp_lib_is_layout_compatible, the macro that informs BSLS_LIBRARYFEATURES_HAS_CPP20_IS_LAYOUT_COMPATIBLE, is also defined. See the last sentence of P0466R5.

This macro is defined first for the following compiler versions:

(no current version of clang supports this feature)

BSLS_LIBRARYFEATURES_HAS_CPP20_IS_LAYOUT_COMPATIBLE

The BSLS_LIBRARYFEATURES_HAS_CPP20_IS_LAYOUT_COMPATIBLE macro is defined if the bsl::is_layout_compatible meta function is available.

Note that the standard feature test macro __cpp_lib_is_layout_compatible is also defined and has a value of at least 201907L.

This macro is defined first for the following compiler versions:

(no current version of clang supports this feature)

BSLS_LIBRARYFEATURES_HAS_CPP20_IS_POINTER_INTERCONVERTIBLE

The BSLS_LIBRARYFEATURES_HAS_CPP20_IS_POINTER_INTERCONVERTIBLE macro is defined if the bsl::is_pointer_interconvertible_base_of and bsl::is_pointer_interconvertible_with_class meta functions are available.

Note that the standard feature test macro __cpp_lib_is_pointer_interconvertible is also defined and has a value of at least 201907L.

This macro is defined first for the following compiler versions:

(no current version of clang supports this feature)

BSLS_LIBRARYFEATURES_HAS_CPP20_JTHREAD

The BSLS_LIBRARYFEATURES_HAS_CPP20_JTHREAD macro is defined if the C++20 bsl::jthread class in the <bsl_thread.h> header available.

Note that the standard feature test macro __cpp_lib_jthread is also defined and has a value of at least 201911L.

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP20_MAKE_UNIQUE_FOR_OVERWRITE

The BSLS_LIBRARYFEATURES_HAS_CPP20_MAKE_UNIQUE_FOR_OVERWRITE macro is defined if the bsl::make_unique_for_overwrite function is available with C++20 semantics.

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES

The BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES macro is defined if the native standard library provides the <ranges> header and implements all required C++20 content with no major issues.

This macro is defined if the standard __cpp_lib_ranges feature-test macro is defined and __cpp_lib_ranges >= 202110L.

This macro is defined first for the following compiler versions:

Note that GCC 11 ranges support is incomplete, as it is missing a number of key Defect Report fixes, notably P2259R1, P2210R2, P2432R1, and P2415R2, the latter being a breaking change between GCC 11 and GCC 12.

BSLS_LIBRARYFEATURES_HAS_CPP20_SOURCE_LOCATION

The BSLS_LIBRARYFEATURES_HAS_CPP20_SOURCE_LOCATION macro is defined if the native standard library provides the <source_location> header and implements all required C++20 content with no major issues.

This macro is defined if the standard __cpp_lib_source_location feature-test macro is defined and __cpp_lib_source_location >= 201907L.

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP20_SYNCSTREAM

The BSLS_LIBRARYFEATURES_HAS_CPP20_SYNCSTREAM macro is defined if the native standard library provides the <syncstream> header and implements all required content with no major issues.

This macro is defined if the standard __cpp_lib_syncbuf feature-test macro is defined and __cpp_lib_syncbuf >= 201803L.

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP20_TO_ARRAY

The BSLS_LIBRARYFEATURES_HAS_CPP20_TO_ARRAY macro is defined if the native standard library implements the to_array factory function in the <array> header correctly with no major issues.

This macro is defined if the standard __cpp_lib_to_array feature-test macro is defined and __cpp_lib_to_array >= 201907L.

BSLS_LIBRARYFEATURES_HAS_CPP20_TIMEZONE

The BSLS_LIBRARYFEATURES_HAS_CPP20_TIMEZONE macro is defined if the following C++20 timezone features are available in bsl::chrono namespace:

This macro is defined if the standard __cpp_lib_chrono feature-test macro has at least 201907L value, and on GCC the compiler is allowed to use the C++11 (or later) ABI.

This feature has been provided by MSVC++ compiler since VS 2019 16.10. But that release was shipped with the following important note: "While the STL generally provides all features on all supported versions of Windows, leap seconds and time zones (which change over time) require OS support that was added to Windows 10. Specifically, updating the leap second database requires Windows 10 version 1809 or later, and time zones require <tt>icu.dll</tt> which is provided by Windows 10 version 1903/19H1 or later. This applies to both client and server OSes; note that Windows Server 2019 is based on Windows 10 version 1809." If the feature is used on a host that does not provide `icu.dll`, an exception with "The specified module could not be found." message will be thrown. For this reason those features are disabled by default on Windows.

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP20_VERSION

The BSLS_LIBRARYFEATURES_HAS_CPP20_VERSION macro is defined if the native standard library provides the <version> header and implements all required content with no major issues.

A new header, <version>, that defines library feature-test macros has been added in C++20. For better compatibility with the standard library BSLS_LIBRARYFEATURES macros should be based on the standard feature test macro when it is appropriate. See the "STANDARD FEATURE-DETECTION MACROS" section below.

This macro is defined first for the following compiler versions:

BSLS_LIBRARYFEATURES_HAS_CPP23_ALLOCATE_AT_LEAST

The BSLS_LIBRARYFEATURES_HAS_CPP23_ALLOCATE_AT_LEAST is defined if the following C++23 features are available in the <bsl_memory.h> header:

Note that the standard feature test macro __cpp_lib_allocate_at_least is also defined and has a value of at least 202302L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_BASELINE_LIBRARY

This macro is used to identify whether the current platform's standard library supports a baseline set of C++23 library features (which are defined below). This is especially important in BSL when importing standard library functions and types into the bsl:: namespace, as is done in bsl+bslhdrs.

This macro is defined if all of the listed conditions are true:

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_BIND_BACK

The BSLS_LIBRARYFEATURES_HAS_CPP23_BIND_BACK is defined if the C++23 bsl::bind_back function is available in the <bsl_functional.h> header.

Note that the standard feature test macro __cpp_lib_bind_back is also defined and has a value of at least 202202L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_CONTAINERS_RANGES

The BSLS_LIBRARYFEATURES_HAS_CPP23_CONTAINERS_RANGES is defined if the C++23 bsl::from_range_t type and the bsl::from_range value are available in the <bsl_range.h> header.

Note that the standard feature test macro __cpp_lib_containers_ranges is also defined and has a value of at least 202202L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_FORWARD_LIKE

The BSLS_LIBRARYFEATURES_HAS_CPP23_FORWARD_LIKE is defined if the C++23 bsl::forward_like function is available in the <bsl_utility.h> header.

Note that the standard feature test macro __cpp_lib_forward_like is also defined and has a value of at least 202207L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_GENERATOR

The BSLS_LIBRARYFEATURES_HAS_CPP23_GENERATOR is defined if the following C++23 features are available:

Note that the standard feature test macro __cpp_lib_generator is also defined and has a value of at least 202207L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_INT_CHARCONV

The BSLS_LIBRARYFEATURES_HAS_CPP23_INT_CHARCONV macro is defined if the std::to_chars and std::from_chars functions for all standard signed and unsigned integer types and char provided by <charconv> are constexpr.

Note that the standard feature test macro __cpp_lib_constexpr_charconv is also defined and has a value of at least 202207L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_IS_IMPLICIT_LIFETIME

The BSLS_LIBRARYFEATURES_HAS_CPP23_IS_IMPLICIT_LIFETIME is defined if the following C++23 features are available in the <bsl_type_traits.h> header:

Note that the standard feature test macro __cpp_lib_is_implicit_lifetime is also defined and has a value of at least 202302L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_MDSPAN

The BSLS_LIBRARYFEATURES_HAS_CPP23_MDSPAN is defined if the following C++23 features are available:

Note that the standard feature test macro __cpp_lib_mdspan is also defined and has a value of at least 202207L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_OUT_PTR

The BSLS_LIBRARYFEATURES_HAS_CPP23_OUT_PTR is defined if the following C++23 features are available in the <bsl_memory.h> header:

Note that the standard feature test macro __cpp_lib_out_ptr is also defined and has a value of at least 202106L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_PRINT

The BSLS_LIBRARYFEATURES_HAS_CPP23_PRINT macro is defined if the native standard library provides the <print> header and implements all required C++23 content, including the DRs from C++26, with no major issues.

Note that the standard feature test macro __cpp_lib_print is also defined and has a value of at least 202403L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_RANGE_ADAPTOR_CLOSURE

The BSLS_LIBRARYFEATURES_HAS_CPP23_RANGE_ADAPTOR_CLOSURE is defined if the C++23 bsl::ranges::range_adaptor_closure class is available in the <bsl_range.h> header.

Note that the standard feature test macro __cpp_lib_ranges is also defined and has a value of at least 202202L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_CARTESIAN_PRODUCT

The BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_CARTESIAN_PRODUCT is defined if the C++23 bsl::views::cartesian_product view and the bsl::ranges::cartesian_product_view class are available in the <bsl_range.h> header.

Note that the standard feature test macro __cpp_lib_ranges_cartesian_product is also defined and has a value of at least 202207L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_CHUNK

The BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_CHUNK is defined if the C++23 bsl::views::chunk view and the bsl::ranges::chunk_view class are available in the <bsl_range.h> header.

Note that the standard feature test macro __cpp_lib_ranges_chunk is also defined and has a value of at least 202202L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_ENUMERATE

The BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_ENUMERATE is defined if the C++23 bsl::views::enumerate view and the bsl::ranges::enumerate_view class are available in the <bsl_range.h> header.

Note that the standard feature test macro __cpp_lib_ranges_enumerate is also defined and has a value of at least 202302L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_RANGE_FORMAT

The BSLS_LIBRARYFEATURES_HAS_CPP23_RANGE_FORMAT macro is defined when the range formatting support of C++23 (P2286R8, P2585R1, LWG3750) is present in the <format> header and it is in a usable state.

BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_AS_CONST

The BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_AS_CONST is defined if the following C++23 features are available:

Note that the standard feature test macro __cpp_lib_ranges_as_const is also defined and has a value of at least 202207L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_CONTAINS

The BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_CONTAINS is defined if the following C++23 features are available in the <bsl_algorithm.h> header:

Note that the standard feature test macro __cpp_lib_ranges_contains is also defined and has a value of at least 202207L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_FIND_LAST

The BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_FIND_LAST is defined if the following C++23 features are available in the <bsl_algorithm.h> header:

Note that the standard feature test macro __cpp_lib_ranges_find_last is also defined and has a value of at least 202207L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_FOLD

The BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_FOLD is defined if the following C++23 features are available in the <bsl_algorithm.h> header:

Note that the standard feature test macro __cpp_lib_ranges_fold is also defined and has a value of at least 202207L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_IOTA

The BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_IOTA is defined if the following C++23 features are available:

Note that the standard feature test macro __cpp_lib_ranges_iota is also defined and has a value of at least 202202L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_JOIN_WITH

The BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_JOIN_WITH is defined if the C++23 bsl::views::join_with view and the bsl::ranges::join_with_view class are available in the <bsl_range.h> header.

Note that the standard feature test macro __cpp_lib_ranges_join_with is also defined and has a value of at least 202202L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_SHIFT

The BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_SHIFT is defined if the following C++23 features are available in the <bsl_algorithm.h> header:

Note that the standard feature test macro __cpp_lib_shift is also defined and has a value of at least 202202L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_SLIDE

The BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_SLIDE is defined if the C++23 bsl::views::slide view and the bsl::ranges::slide_view class are available in the <bsl_range.h> header.

Note that the standard feature test macro __cpp_lib_ranges_slide is also defined and has a value of at least 202202L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_STARTS_ENDS_WITH

The BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_STARTS_ENDS_WITH is defined if the following C++23 features are available in the <bsl_algorithm.h> header:

Note that the standard feature test macro __cpp_lib_ranges_starts_ends_with is also defined and has a value of at least 202106L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_STRIDE

The BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_STRIDE is defined if the C++23 bsl::views::stride view and the bsl::ranges::stride_view class are available in the <bsl_range.h> header.

Note that the standard feature test macro __cpp_lib_ranges_stride is also defined and has a value of at least 202207L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_TO_CONTAINER

The BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_TO_CONTAINER is defined if the C++23 bsl::ranges::to function is available in the <bsl_range.h> header.

Note that the standard feature test macro __cpp_lib_ranges_to_container is also defined and has a value of at least 202202L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_ZIP

The BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_ZIP is defined if the following C++23 features are available in the <bsl_range.h> header:

Note that the standard feature test macro __cpp_lib_ranges_zip is also defined and has a value of at least 202110L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_REFERENCE_FROM_TEMPORARY

The BSLS_LIBRARYFEATURES_HAS_CPP23_REFERENCE_FROM_TEMPORARY is defined if the following C++23 features are available in the <bsl_type_traits.h> header:

Note that the standard feature test macro __cpp_lib_reference_from_temporary is also defined and has a value of at least 202202L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_SPANSTREAM

The BSLS_LIBRARYFEATURES_HAS_CPP23_SPANSTREAM is defined if the following C++23 features are available:

Note that the standard feature test macro __cpp_lib_spanstream is also defined and has a value of at least 202106L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_STACKTRACE

The BSLS_LIBRARYFEATURES_HAS_CPP23_STACKTRACE is defined if the following C++23 features are available in the <bsl_stacktrace.h> header:

Note that the standard feature test macro __cpp_lib_stacktrace is also defined and has a value of at least 202011L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_HAS_CPP23_START_LIFETIME_AS

The BSLS_LIBRARYFEATURES_HAS_CPP23_START_LIFETIME_AS is defined if the following C++23 features are available in the <bsl_memory.h> header:

Note that the standard feature test macro __cpp_lib_start_lifetime_as is also defined and has a value of at least 202207L.

This macro is defined first for the following Standard Library implementations:

BSLS_LIBRARYFEATURES_STDCPP_GNU

The BSLS_LIBRARYFEATURES_STDCPP_GNU macro is defined if the C++ standard library implementation is GNU libstdc++.

BSLS_LIBRARYFEATURES_STDCPP_IBM

The BSLS_LIBRARYFEATURES_STDCPP_IBM macro is defined if the C++ standard library implementation is IBM's VACPP.

BSLS_LIBRARYFEATURES_STDCPP_INTELLISENSE

The BSLS_LIBRARYFEATURES_STDCPP_INTELLISENSE macro is defined if Microsoft's Intellisense is running (instead of a production compiler). Note that detecting Intellisense does not mean that the MSVC compiler is used. Visual Studio 2017 is capable of cross platform development using clang and Visual Studio Code (also featuring Intellisense) may be used with virtually any compiler.

BSLS_LIBRARYFEATURES_STDCPP_LIBCSTD

The BSLS_LIBRARYFEATURES_STDCPP_LIBCSTD macro is defined if the C++ standard library implementation is a Rogue Wave implementation.

BSLS_LIBRARYFEATURES_STDCPP_LLVM

The BSLS_LIBRARYFEATURES_STDCPP_LLVM_LIBCPP macro is defined if the C++ standard library implementation is LLVM's libc++.

BSLS_LIBRARYFEATURES_STDCPP_MSVC

The BSLS_LIBRARYFEATURES_STDCPP_MSVC macro is defined if the C++ standard library implementation is Microsoft's (Dinkumware based) implementation.

BSLS_LIBRARYFEATURES_STDCPP_STLPORT

The BSLS_LIBRARYFEATURES_STDCPP_STLPORT macro is defined if the C++ standard library implementation is an STLPort implementation.

Usage

In this section we show intended usage of this component.

Example 1: Managing Library-Dependent Interfaces

When building software across multiple platforms a programmer may have to deal with different versions of the native standard library, some providing features that the others do not. The macros defined in this component can be used make features visible only if the required native standard library features are present.

For example, the tuple-type is not available in older versions of the native standard library. Suppose we have a utility component that returns an instance of a tuple of values if the underlying version of the standard library provides that type, and yet remain compilable otherwise.

First, we conditionally include the header file we will need if we define an interface that returns a std::tuple.

#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_TUPLE)
# include <tuple> {#bsls_libraryfeatures-include-tuple}
#endif // BSLS_LIBRARYFEATURES_HAS_CPP11_TUPLE

Then, we declare the methods that will be unconditionally provided by our utility component:

struct MyStatisticalUtil
{
/// Return the median (mean, variance) of the sequence of values in
/// the specified non-empty, semi-open range `[begin, end)`. The
/// behavior is undefined unless `begin < end`.
static double mean(const int *begin, const int *end);
static int median(const int *begin, const int *end);
static double variance(const int *begin, const int *end);

Now, we conditionally define an interface that returns a std::tuple, if that type is available. Note that, if all three values are needed, calling this interface is more efficient than calling the earlier three individually because the input need be traversed one time, not three, and if C++17 is enabled the result may be used to create a structured binding.

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_TUPLE
/// Return the median, mean, and variance (in that order) of the
/// sequence of values in the specified non-empty, semi-open range
/// `[begin, end)`. The behavior is undefined unless `begin < end`.
static std::tuple<int, double, double> getMedianMeanVariance(
const int *begin,
const int *end);
#endif // BSLS_LIBRARYFEATURES_HAS_CPP11_TUPLE
};

Finally, we find that our code compiles when we build our code against versions of the native standard library that provide a tuple type, and those that do not. Of course, in the later case the interface that returns a tuple is not defined for the MyStatisticalUtil struct.

Variables

const char * BSLS_LIBRARYFEATURES_LINKER_CHECK_NAME
 

Macro Definition Documentation

◆ BSLS_LIBRARYFEATURES_DETECTION_IN_PROGRESS

#define BSLS_LIBRARYFEATURES_DETECTION_IN_PROGRESS

◆ BSLS_LIBRARYFEATURES_HAS_C90_GETS

#define BSLS_LIBRARYFEATURES_HAS_C90_GETS   1

Set unconditionally for compilers supporting an earlier standard than C++14; this feature macro will be undefined for those platforms with partial support for C++14, implementing the removal of this dangerous function.

◆ BSLS_LIBRARYFEATURES_HAS_CPP98_AUTO_PTR

#define BSLS_LIBRARYFEATURES_HAS_CPP98_AUTO_PTR   1

Set unconditionally. This features is found on each compiler version/platform combination tested. Assume universally available until the day tool chains start removing this deprecated class template.

◆ BSLS_LIBRARYFEATURES_HAS_CPP98_BINDERS_API

#define BSLS_LIBRARYFEATURES_HAS_CPP98_BINDERS_API   1

These APIs should be removed in C++20. Undefined conditionally later in this file for implementations that still have it.

◆ BSLS_LIBRARYFEATURES_LINKER_CHECK_NAME

#define BSLS_LIBRARYFEATURES_LINKER_CHECK_NAME   bsls_libraryfeatures_CPP20_ABI

The following macro is not defined as it is not covered by any C++20 standard feature test macro and the feature it represents not supported by any current compilers. Format support is complicated:

  • libstdc++ 13.1 defines the feature test macro to be 202106L even though they do implement P2372 and P2418, which bumped the feature test macro to 202110L. This is GCC bug 111826.
  • libc++ does not define the feature test macro as of version 17 because they have not implemented chrono time zones yet. We would prefer to use libc++'s <format> despite the missing functionality, because we will not be backporting the formatters for chrono time zones anyway. However, until release 20.1.0 there is a severe bug with handling fixed length character arrays in the implementation of std::format (see https://github.com/llvm/llvm-project/issues/115935) so we disable the feature even if the standard feature test macro is defined.
  • MSVC uses the correct value. But also, an older version of Clang might be used with a newer version of libstdc++. In that case, the use of std::format may result in errors because Clang consteval support was buggy prior to version 17 (see https://github.com/llvm/llvm-project/commit/e328d68). TBD: is this a concern only for the old ABI short string, that we now have a macro to detect? Per the final sentence of 'P0466R5', the availability of std::is_corresponding_member is linked to the availability of std::is_layout_compatible. Verify that we have full support for integer <charconv> functions before enabling the constexpr versions.

Variable Documentation

◆ BSLS_LIBRARYFEATURES_LINKER_CHECK_NAME

const char* BSLS_LIBRARYFEATURES_LINKER_CHECK_NAME
extern