28th August 2023

BSL Support for C++20

Introduction

The BSL standard library was created to provide a scoped-allocator enhanced standard library that supports (to the extent possible) modern features on a wide range of platforms. To achieve this goal, BSL provides its own implementation of allocator-aware Standard Library types in the bsl namespace (such as bsl::optional) and provides aliases for most other Standard Library types for uniformity of use. Furthermore, the BSL-provided allocator-aware types as well as several important non-allocator-aware vocabulary types, such as bsl::string_view, are available for use across all supported platforms (e.g., unlike std::optional and std::string_view, bsl::optional and bsl::string_view are available in C++03)

Over the past year, we have been working to enhance BSL to provide developers with access to features of the C++ Standard library added in C++20. In addition, where possible, those features have been provided to developers who may not have access to a C++20 toolchain. All the changes related to the BSL C++20 project are now available to users, and are detailed below, though there will still be some ongoing work that relates to C++20 in the future.

Minimum Compiler Requirements

GCC 11.1

Clang 15

(with libc++ 15 or libstdc++ 11)

Visual Studio 2022 (MSVC 19.20)

These limitations do not apply to features back-ported to earlier language standards (see Summary of C++20 Features Available in C++17/14/11/03 below). It was impractical to provide C++20 support for earlier compiler versions as their support for the new Standard was found to be insufficiently complete.

This project delivered the following enhancements:

  • Additional feature test macros added.

  • Newly added standard library types, traits and functions aliased.

  • Three way comparison (“spaceship”) operators added.

  • shared_ptr free functions enhanced with array support, back-ported to C++03.

  • Allocator-aware implementations of the new C++20 free functions in <memory> added and back-ported to C++03

  • Allocator-aware implementations of the new C++20 types in <stop_token> added and back-ported to C++03

  • Allocator-aware synchronized output streams added and back-ported to C++03.

  • Additional <ostream> and <ios> manipulators added and back-ported to C++03.

  • BDE container implementations enhanced with new methods and free functions, back-ported to C++03.

  • Additional constructors added to bsl::string_view.

  • BDE library test drivers enhanced to includes C++20 Ranges and Concepts compatibility checking.

Notable New Features

C++20 includes a large number of language and library enhancements. Some of the key changes to the BDE library to support C++20 are detailed below.

Additional feature test macros

BDE has added a number of new feature test macros, detailed in subsequent sections.

Of particular note is the macro BSLS_LIBRARYFEATURES_HAS_CPP20_BASELINE_LIBRARY which indicates the availability of a reasonable selection of C++20 standard library features.

Although compiler versions for individual macros vary (see Complete Description of Changes below for details), BSLS_LIBRARYFEATURES_HAS_CPP20_BASELINE_LIBRARY is currently set on the following platforms:

  • GCC 11.1

  • clang 15 when compiling against

    • libc++ version 15, or

    • libstdc++ version 11

  • Visual Studio 2022 / MSVC 19.30

Aliasing standard library headers, traits, types and functions

C++20 introduced a number of new headers, types, traits and free functions. For all of the new headers, corresponding BDE headers were created aliasing the standard library types into the bsl namespace.

For standard library types, traits and free functions added to existing standard library headers, additional aliases were added to the corresponding BDE header.

There were a few notable exceptions made, which are detailed in the Decision Points and Rationale section below. Also note that the availability of aliases depends on the availability of corresponding standard library types.

Three-way comparison (“spaceship”) operator

For any container in the standard which now has a three-way comparison operator, the equivalent BDE container has been enhanced with a three-way comparison operator when such operators are supported by the compiler.

Array support in bsl::shared_ptr

Array support in std::shared_ptr started in C++17, and those changes were reflected in bsl::shared_ptr as part of the C++17 compatibility project. C++20 added array support in the associated free functions, and BDE’s equivalent functions were enhanced to include array support (back-ported to C++03)

  • make_shared

  • allocate_shared

Allocator-aware implementations of additional functions in <memory>

C++20 added two additional free functions to the <memory> header. We have created BDE implementations of these back-ported to C++03.

  • make_shared_for_overwrite

  • allocate_shared_for_overwrite

Allocator-aware implementations of additional types in <stop_token>

C++20 added a new <stop_token> header, containing the following types

  • std::nostopatate_t

  • std::stop_callback

  • std::stop_source

  • std::stop_token

We created allocator-aware implementations of these types, back-ported to C++03.

Concepts

C++20 added compiler support for Concepts and a number of standard library concepts. The standard library Concepts were aliased into the bsl namespace, and our test drivers enhanced to ensure that our containers correctly model the appropriate concepts.

In addition, to prevent future conflicts with standard library concepts that are defined in terms of standard traits, the following traits were updated to delegate to the standard library traits where available (C++11 and later), retaining the BDE implementations where not (C++03):

  • bslmf_isfloatingpoint

  • bslmf_isintegral

  • bslmf_islvaluereference

Ranges

The BDE test drivers were enhanced to ensure compatibility between the BDE containers and the standard ranges library. Note, however, that bsl::map and associated containers are incompatible with some aspects of the C++20 ranges library (see the Decision Points and Rationale section below for details).

Synchronized output streams

C++20 added a new <syncstream> header, containing the types std::basic_syncbuf and std::osyncstream. We created allocator-aware implementations of these types, back-ported to C++03.

Additional stream manipulators

C++20 added additional manipulators to the <ostream> and <ios> headers. We created allocator-aware implementations of these types, back-ported to C++03.

  • emit_on_flush (in <ostream>)

  • noemit_on_flush (in <ostream>)

  • defaultfloat (in <ios>)

Additional bsl::to_array free function

C++20 added a number of additional free functions. We implemented the bsl::to_array free function, back-ported to C++03.

Note that:

  • In C++20, bsl::to_array is an alias for the standard library implementation.

  • In C++03 and C++11, the implementation is limited by the fact that the contained type is required to be default constructible.

Additional container methods

C++20 added a number of additional member functions to the standard library containers. The following were implemented for the BDE containers, back-ported to C++03:

  • contains method on all of the BDE associative containers.

  • starts_with and ends_with methods on bsl::basic_string.

Additional string_view constructor.

C++20 added a constructor to the standard library string_view, taking an iterator and a sentinel for that iterator type, denoting a range.

  • In C++20, bsl::string_view is an alias to std::string_view so this constructor is available.

  • In C++17, bsl::string_view is an alias to std::string_view so this constructor is not available.

  • In C++ versions prior to 17, an approximation of this constructor has been added to the BDE implementation of string_view.

For details see the Decision Points and Rationale section below.

Summary of C++20 Features Available in C++17/14/11/03


Feature C++20 Backporting
C++17 C++14 C++11 C++03
Additional feature test macros
Aliasing standard library types, traits, functions & concepts
Spaceship operator
bsl::shared_ptr array support
Allocator-aware *_shared_for_overwrite functions
Allocator-aware stop_token and associated types
Delegation of traits to standard library:
  • - bslmf_isfloatingpoint
  • - bslmf_isintegral
  • - bslmf_islvaluereference
(see text for details)
Own
Impl.
Allocator-aware synchronized output stream
Additional stream manipulators
to_array free function (see text for details)
(aliased)
Partial Partial
contains method on associative containers
starts_with and ends_with on bsl::basic_string
Additional string_view constructor
(see text for details)
Partial Partial Partial
Compatibility with standard Concepts library
Compatibility with standard ranges library
(associative container exceptions - see text)

(except map)

 
 

Decision Points and Rationale

Full ranges support for associative containers such as bsl::map

In order to meet the requirements of std::ranges::views::elements and std::ranges::elements_view, the element type would need to be tuple-like, which in this case would require that it be a specialization of std:pair. This is not possible given the current use of bsl::pair.

Addressing this issue has been deferred pending further investigation into the feasibility of bsl::pair inheriting from std::pair.

Uses-allocator construction in <memory>

C++20 added three new functions to the <memory> header:

  • uses_allocator_construction_args

  • make_obj_using_allocator

  • uninitialized_construct_using_allocator

The decision on adding these functions has been deferred until after the project working on the next iteration of the BDE allocator model (converging bslma allocators and C++17 PMR allocators).

Aliasing of the types in <format>.

The Standard Library mandates that functions such as std::format return specializations of std::basic_string. If BSL were to simply alias, for example, std::format to bsl::format, that would result in bsl::format returning an std::string rather than the expected bsl::string.

In the near future, we will consider adding support for the <format> functionality in BSL by either providing a full implementation or wrapping a third-party library. In either case, the amount of work required for implementation is substantial and warrants a separate project.

Coroutines: implement bsl::generator

We considered creating an allocator-aware BDE implementation of a coroutine generator, but as coroutine support in the standard is still evolving we concluded that now would not be the right time.

Alias bsl::integral_constant to std::integral_constant

There is a great deal of code, both within and outside of BDE, that relies on the VALUE member of bsl::integral_constant. This member has been deprecated, with a view to revisiting this issue once all external references to the deprecated member have been removed.

constexpr methods in bsl::string

In C++20, std::string has constexpr constructors and other methods. The constexpr constructor is permitted to allocate memory using the standard allocator or a pmr allocator. However, it is not permitted for a non-standard allocator to allocate memory within a constexpr function.

This means that it is not possible to make the bsl::string constructors constexpr, meaning that it is impossible to have an instance of bsl::string in a constexpr context, consequently rendering addition of constexpr on other member functions pointless.

Aliasing bsl::ranges::range_common_reference_t

Aliasing bsl::ranges::range_common_reference_t was omitted due to an unresolved standard library issue: https://cplusplus.github.io/LWG/issue386

Aliasing bsl::is_bounded_array and bsl::is_unbounded_array

BDE created its own backwards-compatible implementations using bsl::integral_constant rather than std::integral_constant, and aliasing these in C++20 would conflict with that (see bsl::integral_constant item above).

Aliasing of additional free functions in <memory>

C++20 added the following free functions

  • std::make_shared_for_overwrite

  • std::allocate_shared_for_overwrite.

We were unable to simply alias the standard library versions, as they create std::shared_ptr rather than bsl::shared_ptr. We therefore implemented BDE versions of these functions, which are allocator-aware and back ported to C++03.

Aliasing of additional types in <stop_token>

C++20 added the following types to the <stop_token> header.

  • std::nostopatate_t

  • std::stop_callback

  • std::stop_source

  • std::stop_token

We were unable to simply alias the standard library versions, as

  • We need stop_callback to be allocator-aware, and

  • There is value in having these back-ported.

We therefore implemented BDE versions of these functions, which are allocator-aware and back ported to C++03.

shared_ptr atomic operations

We decided that there is unlikely to be sufficient demand for atomic operations on bsl::shared_ptr to justify its inclusion in the current project.

string_view additional constructor in C++17 and earlier

C++20 added a constructor to the standard library string_view, taking an iterator and a sentinel for that iterator type, denoting a range.

  • In C++20, bsl::string_view is an alias to std::string_view so this constructor is available.

  • In C++17, bsl::string_view is an alias to std::string_view so this constructor is not available.

  • In C++ versions prior to 17, the contiguous_iterator and sized_sentinel_for concepts do not exist and cannot be reliably implemented without language support.

We therefore made the following decisions:

Firstly, we would defer the release of this change until the production C++ language version moves to C++20. To do otherwise would result in the unusual situation where C++03 platforms (notably Sun and AIX) have a feature that is not available on C++17 platforms (notably Linux). Deferring this release until the production language version on Linux moves to C++20 will ensure feature parity between platforms and maximize compatibility.

Secondly, on C++14 and earlier, as the SFINAE checks on this constructor could not be implemented exactly, they were approximated using convertibility tests which do not match exactly to the tests used in the standard, but which are valid for the typical use cases.

Complete Description of Changes

Aliasing: Additional headers added

The following headers were added to alias new C++20 standard library additions, and test drivers created:

Header file

Types aliased

bsl_barrier.h


bsl::barrier;

bsl_bit.h


bsl::endian;
bsl::bit_cast;
bsl::has_single_bit;
bsl::bit_ceil;
bsl::bit_floor;
bsl::bit_width;
bsl::rotl;
bsl::rotr;
bsl::countl_zero;
bsl::countl_one;
bsl::countr_zero;
bsl::countr_one;
bsl::popcount;

bsl_compare.h


// Types returned by ‘operator<=>’
bsl::strong_ordering;
bsl::weak_ordering;
bsl::partial_ordering;
// Concepts
bsl::three_way_comparable;
bsl::three_way_comparable_with;
// Meta-functions
bsl::common_comparison_category;
bsl::common_comparison_category_t;
bsl::compare_three_way_result;
bsl::compare_three_way_result_t;
// Customization point objects
bsl::strong_order;
bsl::weak_order;
bsl::partial_order;
bsl::compare_strong_order_fallback;
bsl::compare_weak_order_fallback;
bsl::compare_partial_order_fallback;
// Functors
bsl::compare_three_way;
// Utility functions
bsl::is_eq;
bsl::is_neq;
bsl::is_lt;
bsl::is_lteq;
bsl::is_gt;
bsl::is_gteq;

bsl_concepts.h


bsl::same_as;
bsl::derived_from;
bsl::convertible_to;
bsl::common_reference_with;
bsl::common_with;
bsl::integral;
bsl::signed_integral;
bsl::unsigned_integral;
bsl::floating_point;
bsl::assignable_from;
bsl::swappable;
bsl::swappable_with;
bsl::destructible;
bsl::constructible_from;
bsl::default_initializable;
bsl::move_constructible;
bsl::copy_constructible;

bsl_coroutine.h


bsl::coroutine_traits;
bsl::coroutine_handle;
bsl::noop_coroutine;
bsl::noop_coroutine_promise;
bsl::noop_coroutine_handle;
bsl::suspend_never;
bsl::suspend_always;

bsl_latch.h


bsl::latch;

bsl_numbers.h


bsl::numbers;

bsl_ranges.h


// Range access
bsl::ranges::begin;
bsl::ranges::end;
bsl::ranges::cbegin;
bsl::ranges::cend;
bsl::ranges::rbegin;
bsl::ranges::rend;
bsl::ranges::crbegin;
bsl::ranges::crend;
bsl::ranges::size;
bsl::ranges::ssize;
bsl::ranges::empty;
bsl::ranges::data;
bsl::ranges::cdata;
// Range primitives
bsl::ranges::iterator_t;
bsl::ranges::sentinel_t;
bsl::ranges::range_size_t;
bsl::ranges::range_difference_t;
bsl::ranges::range_value_t;
bsl::ranges::range_reference_t;
bsl::ranges::range_rvalue_reference_t;
// Not yet added
//bsl::ranges::range_common_reference_t;
// Range concepts
bsl::ranges::range;
bsl::ranges::borrowed_range;
bsl::ranges::enable_borrowed_range;
bsl::ranges::sized_range;
bsl::ranges::disable_sized_range;
bsl::ranges::view;
bsl::ranges::enable_view;
bsl::ranges::view_base;
bsl::ranges::input_range;
bsl::ranges::output_range;
bsl::ranges::forward_range;
bsl::ranges::bidirectional_range;
bsl::ranges::random_access_range;
bsl::ranges::contiguous_range;
bsl::ranges::common_range;
bsl::ranges::viewable_range;
// Views
bsl::ranges::view_interface;
bsl::ranges::subrange;
// Dangling iterator handling
bsl::ranges::dangling;
bsl::ranges::borrowed_iterator_t;
bsl::ranges::borrowed_subrange_t;
// Factories
bsl::ranges::empty_view;
bsl::ranges::single_view;
bsl::ranges::iota_view;
bsl::ranges::basic_istream_view;
bsl::ranges::istream_view;
bsl::ranges::wistream_view;
bsl::ranges::views::empty;
bsl::ranges::views::single;
bsl::ranges::views::iota;
bsl::ranges::views::istream;
// Adaptors
bsl::ranges::ref_view;
bsl::ranges::owning_view;
bsl::ranges::filter_view;
bsl::ranges::transform_view;
bsl::ranges::take_view;
bsl::ranges::take_while_view;
bsl::ranges::drop_view;
bsl::ranges::drop_while_view;
bsl::ranges::join_view;
bsl::ranges::lazy_split_view;
bsl::ranges::split_view;
bsl::ranges::common_view;
bsl::ranges::reverse_view;
bsl::ranges::elements_view;
bsl::ranges::keys_view;
bsl::ranges::values_view;
bsl::ranges::views::all_t;
bsl::ranges::views::all;
bsl::ranges::views::counted;
bsl::ranges::views::filter;
bsl::ranges::views::transform;
bsl::ranges::views::take;
bsl::ranges::views::take_while;
bsl::ranges::views::drop;
bsl::ranges::views::drop_while;
bsl::ranges::views::join;
bsl::ranges::views::lazy_split;
bsl::ranges::views::split;
bsl::ranges::views::common;
bsl::ranges::views::reverse;
bsl::ranges::views::elements;
bsl::ranges::views::keys;
bsl::ranges::views::values;
// Enumerations
bsl::ranges::subrange_kind;
// Not yet added - see exclusions above
// bsl::ranges::range_common_reference_t;

bsl_semaphore.h


bsl::counting_semaphore;
bsl::binary_semaphore;

bsl_source_location.h


bsl::source_location;

bsl_version.h


This does not include any type aliasing, simply performing:
#include <version>
This is to enable access to the new feature macros added in C++20.

Aliasing: Additions to existing headers

The following existing headers were enhanced with aliases to new C++20 standard library additions, with test drivers enhanced accordingly:

Header file

Types aliased

bsl_atomic.h


bsl::atomic_ref;
bsl::atomic_char8_t;
bsl::atomic_wait;
bsl::atomic_wait_explicit;
bsl::atomic_notify_one;
bsl::atomic_notify_all;
//BSLS_LIBRARYFEATURES_HAS_CPP20_ATOMIC_LOCK_FREE_TYPE_ALIASES
bsl::atomic_signed_lock_free;
bsl::atomic_unsigned_lock_free;
//BSLS_LIBRARYFEATURES_HAS_CPP20_ATOMIC_WAIT_FREE_FUNCTIONS
bsl::atomic_flag_wait;
bsl::atomic_flag_wait_explicit;
bsl::atomic_flag_notify_one;
bsl::atomic_flag_notify_all;
//BSLS_LIBRARYFEATURES_HAS_CPP20_ATOMIC_FLAG_TEST_FREE_FUNCTIONS
bsl::atomic_flag_test;
bsl::atomic_flag_test_explicit;

bsl_cmath.h


bsl::lerp;

bsl_cuchar.h


//BSLS_LIBRARYFEATURES_HAS_CPP20_CHAR8_MB_CONV
bsl::mbrtoc8;
bsl::c8rtomb;

bsl_execution.h


bsl::execution::unsequenced_policy;
bsl::execution::unseq;

bsl_filesystem.h


bsl::filesystem::begin;
bsl::filesystem::end;

bsl_functional.h


bsl::bind_front;

bsl_initializer_list.h


bsl::begin;
bsl::end;

bsl_ios.h

SEE NOTES ( Additional stream manipulators )

bsl_iterator.h


// 23.2
// 23.3.2.1, incrementable traits
bsl::incrementable
bsl::incrementable_traits
bsl::iter_difference_t
// 23.3.2.2, indirectly readable traits
bsl::indirectly_readable_traits
bsl::iter_value_t
// 23.3.2.3, iterator traits
bsl::iter_reference_t
// 23.3.3.2, ranges::iter_swap
bsl::iter_rvalue_reference_t
bsl::iter_swap
// 23.3.4.2, concept indirectly_readable
bsl::iter_common_reference_t
// 23.3.4.3, concept indirectly_writable
bsl::indirectly_readable
bsl::indirectly_writable
// 23.3.4.4, concept weakly_incrementable
bsl::weakly_incrementable
// 23.3.4.6, concept input_or_output_iterator
bsl::input_or_output_iterator
// 23.3.4.7, concept sentinel_for
bsl::sentinel_for
// 23.3.4.8, concept sized_sentinel_for
bsl::sized_sentinel_for
// 23.3.4.9, concept input_iterator
bsl::input_iterator
// 23.3.4.10, concept output_iterator
bsl::output_iterator
// 23.3.4.11, concept forward_iterator
bsl::forward_iterator
// 23.3.4.12, concept bidirectional_iterator
bsl::bidirectional_iterator
// 23.3.4.13, concept random_access_iterator
bsl::random_access_iterator
// 23.3.4.14, concept contiguous_iterator
bsl::contiguous_iterator
// 23.3.6.2, indirect callables
bsl::indirect_binary_predicate
bsl::indirect_equivalence_relation
bsl::indirect_result_t
bsl::indirect_strict_weak_order
bsl::indirect_unary_predicate
bsl::indirectly_regular_unary_invocable
bsl::indirectly_unary_invocable
// 23.3.6.3, projected
bsl::projected
// 23.3.7.2, concept indirectly_movable
bsl::indirectly_movable
bsl::indirectly_movable_storable
// 23.3.7.3, concept indirectly_copyable
bsl::indirectly_copyable
bsl::indirectly_copyable_storable
// 23.3.7.4, concept indirectly_swappable
bsl::indirectly_swappable
// 23.3.7.5, concept indirectly_comparable
bsl::indirectly_comparable
// 23.3.7.6, concept permutable
bsl::permutable
// 23.3.7.7, concept mergeable
bsl::mergeable
// 23.3.7.8, concept sortable
bsl::sortable
// 23.4.2, iterator tags
bsl::contiguous_iterator_tag
// 23.5.3, move iterators and sentinels
bsl::move_sentinel
// 23.5.4, common iterators
bsl::common_iterator
// 23.5.5, default sentinel
bsl::default_sentinel_t
// 23.5.6, counted iterators
bsl::counted_iterator
// 23.5.7, unreachable sentinel
bsl::unreachable_sentinel_t

bsl_memory.h


bsl::assume_aligned;
bsl::construct_at;
bsl::to_address;
//BSLS_LIBRARYFEATURES_HAS_CPP20_MAKE_UNIQUE_FOR_OVERWRITE
bsl::make_unique_for_overwrite;

bsl_numeric.h


bsl::midpoint;

bsl_type_traits.h


// 20.15.6, type relations
bsl::is_nothrow_convertible;
bsl::is_nothrow_convertible_v;
// 20.15.7.6, other transformations
bsl::common_reference;
bsl::common_reference_t;
bsl::basic_common_reference;
//BSLS_LIBRARYFEATURES_HAS_CPP20_IS_LAYOUT_COMPATIBLE
// 20.15.6, type relations
bsl::is_layout_compatible;
bsl::is_layout_compatible_v;
//BSLS_LIBRARYFEATURES_HAS_CPP20_IS_POINTER_INTERCONVERTIBLE
// 20.15.6, type relations
bsl::is_pointer_interconvertible_base_of;
bsl::is_pointer_interconvertible_base_of_v;
//BSLS_LIBRARYFEATURES_HAS_CPP20_IS_POINTER_INTERCONVERTIBLE
// 20.15.9, member relationships
bsl::is_pointer_interconvertible_with_class;
//BSLS_LIBRARYFEATURES_HAS_CPP20_IS_CORRESPONDING_MEMBER
// 20.15.9, member relationships
bsl::is_corresponding_member;

bsl_utility.h


bsl::cmp_equal;
bsl::cmp_not_equal;
bsl::cmp_less;
bsl::cmp_greater;
bsl::cmp_less_equal;
bsl::cmp_greater_equal;
bsl::in_range;

New feature test macros

Additional compiler features macros were added to bsls_compilerfeatures.h

Macro

Meaning

BSLS_COMPILERFEATURES_SUPPORT_CONCEPTS

The concepts core language feature is supported by the current compiler settings for this platform.


It is defined on the following platforms:
o GCC 12.1
o Visual Studio 2022 17.2.2 / MSVC 19.32
(note that clang has an outstanding bug which prevents it declaring full 202002L concepts support)

BSLS_COMPILERFEATURES_SUPPORT_COROUTINE

Coroutines with C++20 (or later) semantics are supported by the current compiler settings, including the existence of the <coroutine> standard header that provides the basic library facilities necessary to make use of coroutines.


It is defined on the following platforms:
o GCC 11.1
o clang 14
o Visual Studio 2019 16.11 / MSVC 19.29

BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON

The <=> operator is supported by the current compiler settings for this platform. Including full library support as of C++20.


It is defined on the following platforms:
o GCC 10.1
o clang 11
o Visual Studio 2019 16.11 / MSVC 19.29

Additional library features macros were added to bsls_libraryfeatures.h

Macro

Meaning

BSLS_LIBRARYFEATURES_HAS_CPP20_BASELINE_LIBRARY

The current platform’s standard library supports a baseline set of C++20 library features:
o <barrier>
o <bit>
o <latch>
o <numbers>
o <semaphore>
o <source_location>
o <span>
o <stop_token> (not aliased - see above)
It is defined on the following platforms:
o GCC 11.1
o clang 15 when compiling against:
o libc++ version 15, or
o libstdc++ version 11
o Visual Studio 2022 / MSVC 19.30

BSLS_LIBRARYFEATURES_HAS_CPP20_VERSION

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


It is defined on the following platforms:
o GCC 9
o clang 7 when compiling against:
o libc++ version 7, or
o libstdc++ version 9
o Visual Studio 2019 16.2 / MSVC 19.22

BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS

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


It is defined on the following platforms:
o GCC 11.1
o clang 15 when compiling against:
o libc++ version 15, or
o libstdc++ version 11
o Visual Studio 2022 17.2 / MSVC 19.32

BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES

The native standard library provides the <ranges> header and implements all required content with no major issues.


It is defined on the following platforms:
o GCC 12.1
o clang 15 when compiling against:
o libc++ version 15, or
o libstdc++ version 12
o Visual Studio 2022 17.2 / MSVC 19.32

BSLS_LIBRARYFEATURES_HAS_CPP20_MAKE_UNIQUE_FOR_OVERWRITE

The bsl::make_unique_for_overwrite function is available with C++20 semantics.


It is defined on the following platforms:
o GCC 11.1
o clang 15 when compiling against:
o libc++ version 15, or
o libstdc++ version 11
o Visual Studio 2022 / MSVC 19.30

BSLS_LIBRARYFEATURES_HAS_CPP20_CHAR8_MB_CONV

The bsl::mbrtoc8 and bsl::c8rtomb functions are available with C++20 semantics.

(no current compiler supports this feature)

BSLS_LIBRARYFEATURES_HAS_CPP20_CALENDAR

The C++20 Calendar/TZ feature is available in the chrono namespace.


It is defined on the following platforms:
o Visual Studio 2022 / MSVC 19.30
(no current version of GCC or clang supports this feature)

BSLS_LIBRARYFEATURES_HAS_CPP20_IS_LAYOUT_COMPATIBLE

The bsl::is_layout_compatible meta function is available.


It is defined on the following platforms:
o GCC 12.1
o Visual Studio 2022 / MSVC 19.30
(no current version of clang supports this feature)

BSLS_LIBRARYFEATURES_HAS_CPP20_IS_CORRESPONDING_MEMBER

The bsl::is_corresponding_member meta function is available.


It is defined on the following platforms:
o GCC 12.1
o Visual Studio 2022 / MSVC 19.30
(no current version of clang supports this feature)

BSLS_LIBRARYFEATURES_HAS_CPP20_IS_POINTER_INTERCONVERTIBLE

The bsl::is_pointer_interconvertible_base_of and bsl::is_pointer_interconvertible_with_class meta functions are available.


It is defined on the following platforms:
o GCC 12.1
o Visual Studio 2022 / MSVC 19.30
(no current version of clang supports this feature)

BSLS_LIBRARYFEATURES_HAS_CPP20_ATOMIC_LOCK_FREE_TYPE_ALIASES

The bsl::atomic_signed_lock_free and bsl:atomic_unsigned_lock_free types are available with C++20 semantics.


It is defined on the following platforms:
o GCC 13
o Visual Studio 2022 / MSVC 19.30
(no current version of clang supports this feature)

BSLS_LIBRARYFEATURES_HAS_CPP20_ATOMIC_WAIT_FREE_FUNCTIONS

The following free functions are available with C++20 semantics:

bsl::atomic_flag_wait,
bsl::atomic_flag_wait_explicit,
bsl::atomic_flag_notify_one,
bsl::atomic_flag_notify_all
It is defined on the following platforms:
o clang 15 when compiling against libc++ version 15
o Visual Studio 2022 / MSVC 19.30
(no current version of GCC supports this feature)

BSLS_LIBRARYFEATURES_HAS_CPP20_ATOMIC_FLAG_TEST_FREE_FUNCTIONS

The bsl::atomic_flag_test and bsl::atomic_flag_test_explicit functions are available with C++20 semantics.


It is defined on the following platforms:
o clang 15 when compiling against libc++ version 15
o Visual Studio 2022 / MSVC 19.30
(no current version of GCC supports this feature)