BDE 4.14.0 Production release
|
Macros | |
#define | BSLS_LIBRARYFEATURES_DETECTION_IN_PROGRESS |
#define | BSLS_LIBRARYFEATURES_HAS_C90_GETS 1 |
#define | BSLS_LIBRARYFEATURES_HAS_CPP98_AUTO_PTR 1 |
#define | BSLS_LIBRARYFEATURES_HAS_CPP98_BINDERS_API 1 |
#define | BSLS_LIBRARYFEATURES_LINKER_CHECK_NAME bsls_libraryfeatures_CPP11_ABI |
Variables | |
const char * | BSLS_LIBRARYFEATURES_LINKER_CHECK_NAME |
Provide macros to identify native standard library features.
gets
providedsnprintf
providedauto_ptr
providedbegin
and end
providedtuple
providedunique_ptr
providedptr_fun
et al. gone<charconv>
for integers only<charconv
> support w floats<filesystem>
<execution>
<memory_resource>
pmr::string
<ctime>
<cstdlib>
<version>
result_of
et al. gone<concepts>
<ranges>
<source_location>
atomic_ref
atomic_[un]signed_lock_free
bsl::atomic_flag_wait[_explicit]
bsl::atomic_flag_test[_explicit]
*_for_overwrite
<chrono>
Calendar/TZ additionsmbrtoc8
& c8rtomb
std::jthread
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.
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.
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.
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.
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
:
<cmath>
fpclassify
isfinite
isinf
isnan
isnormal
signbit
isgreater
isgreaterequal
isless
islessequal
islessgreater
isunordered
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
:
<cctype>
isblank
<cmath>
double_t
float_t
<cmath>
acosh
asinh
atanh
cbrt
copysign
erf
erfc
exp2
expm1
fdim
fma
fmax
fmin
hypot
ilogb
lgamma
llrint
log1p
log2
logb
lrint
lround
llround
nan
nanl
nanf
nearbyint
nextafter
nexttoward
remainder
remquo
rint
round
scalbln
scalbn
tgamma
trunc
<cstdlib>
atoll
llabs
lldiv
lldiv_t
strtof
strtold
strtoll
strtoull
<cstdio>
vfscanf
vsscanf
vsnprintf
vsscanf
<cwchar>
vfwscanf
vswscanf
vwscanf
wcstof
wcstold
wcstoll
wcstoull
<cwctype>
iswblank
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.
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
.
<cstdio>
snprintf
This macro is defined first for the following compiler versions:
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.
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.
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:
<algorithm>
all_of
any_of
copy_if
copy_n
find_if_not
is_heap
is_heap_until
is_partitioned
is_permutation
is_sorted
is_sorted_until
minmax
move
none_of
shuffle
<atomic>
<complex>
acosh
asinh
atanh
proj
<exception>
exception_ptr
<functional>
bind
bit_and
bit_or
bit_xor
cref
is_bind_expression
is_placeholder
mem_fn
ref
<iomanip>
<ios>
io_errc
is_error_code_enum
make_error_code
make_error_condition
hexfloat
defaultfloat
<iterator>
begin
end
make_move_iterator
next
prev
<locale>
isblank
<memory>
addressof
uninitialized_copy_n
<numeric>
iota
<typeinfo>
type_info::hash_code
<utility>
declval
forward
move
move_if_noexcept
swap
<array>
<atomic>
<chrono>
<codecvt>
<condition_variable>
<forward_list>
<future>
<mutex>
<random>
<regex>
<scoped_allocator>
<system_error>
<thread>
<typeindex>
<unordered_map>
<unordered_set>
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.
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:
<chrono>
<complex>
<functional>
<iterator>
<iomanip>
<memory>
<type_traits>
is_null_pointer
is_final
<utility>
exchange
<shared_mutex>
is available providing the standard components.This macro is defined first for the following compiler versions:
The BSLS_LIBRARYFEATURES_HAS_CPP14_INTEGER_SEQUENCE
macro is defined if all of the listed conditions are true:
BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
macro is defined.BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES
macro is also defined.BSLS_COMPILERFEATURES_SUPPORT_ALIAS_TEMPLATES
macro is also defined.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:
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:
<any>
<optional>
<variant>
<string_view>
This macro is defined first for the following compiler versions:
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:
<barrier>
<bit>
<latch>
<numbers>
<semaphore>
<span>
<stop_token>
<type_traits>
header defines:std::remove_cvref
std::type_identify
This macro is defined first for the following compiler versions:
The BSLS_LIBRARYFEATURES_HAS_CPP11_EXCEPTION_HANDLING
macro is defined if both of the listed conditions are true:
BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
macro is defined.<exception>
:exception_ptr
make_exception_ptr
rethrow_if_nested
throw_with_nested
This macro is defined first for the following compiler versions:
The BSLS_LIBRARYFEATURES_HAS_CPP11_GARBAGE_COLLECTION_API
macro is defined if both of the listed conditions are true:
BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
macro is defined.<memory>
:declare_no_pointers
get_pointer_safety
undeclare_no_pointers
This macro is defined first for the following compiler versions:
The BSLS_LIBRARYFEATURES_HAS_CPP11_MISCELLANEOUS_UTILITIES
macro is defined if both of the listed conditions are true:
BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
macro is defined.<cstddef>
max_align_t
<exception>
<iomanip>
<locale>
isblank
<memory>
align
<new>
bad_array_new_length
get_new_handler
This macro is defined first for the following compiler versions:
Notice that the function get_unexpected will be removed in C++17.
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:
Notice that the existence of the above constructor implies that each of the following conditions are also true:
piecewise_construct_t
(tag) type (defined in <utility>
) is provided by the native standard library.BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
macro is defined.BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES
macro is defined.BSLS_LIBRARYFEATURES_HAS_CPP11_TUPLE
macro is defined.This macro is defined first for the following compiler versions:
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:
BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
macro is defined.<atomic>
header:atomic_int8_t
atomic_int16_t
atomic_int32_t
atomic_int64_t
atomic_uint8_t
atomic_uint16_t
atomic_uint32_t
atomic_uint64_t
atomic_intptr_t
atomic_uintptr_t
This macro is defined first for the following compiler versions:
The BSLS_LIBRARYFEATURES_HAS_CPP17_SEARCH_FUNCTORS
macro is defined if the native library supplies the following class templates in <functional>
:
boyer_moore_searcher
boyer_moore_horspool_searcher
Currently the following compilers define this function template in C++17 or later modes:
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]:
Currently the following compilers define this function template in C++17 or later modes:
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.
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.
The BSLS_LIBRARYFEATURES_HAS_CPP11_PROGRAM_TERMINATION
macro is defined if of the listed conditions are true:
BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
macro is defined.<cstdlib>
header:_Exit
at_quick_exit
This macro is defined first for the following compiler versions:
The BSLS_LIBRARYFEATURES_HAS_CPP11_RANGE_FUNCTIONS
is defined if the following functions are provided by the native standard library in the <iterator>
header:
This macro is defined first for the following compiler versions:
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:
This macro is defined first for the following compiler versions:
The BSLS_LIBRARYFEATURES_HAS_CPP11_STREAM_MOVE
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.
The BSLS_LIBRARYFEATURES_HAS_CPP11_TUPLE
macro is defined if both of the listed conditions are true:
BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
macro is defined.tuple
type template (defined in <tuple>
) is provided by the native standard library.BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES
macro is also defined.This macro is defined first for the following compiler versions:
The BSLS_LIBRARYFEATURES_HAS_CPP11_UNIQUE_PTR
macro is defined if both of the listed conditions are true:
BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
macro is defined.unique_ptr
class template (defined in <memory>
) is provided by the native standard library.BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
macro is also defined.This macro is defined first for the following compiler versions:
The BSLS_LIBRARYFEATURES_HAS_CPP17_BOOL_CONSTANT
macro is never defined and is mentioned in this component as documentation until its appearance in several BDE test drivers is removed.
The BSLS_LIBRARYFEATURES_HAS_CPP17_BOOL_CONSTANT
macro was intended to indicate whether or not the bool_constant alias template (defined in <type_traits>
) is provided by the native standard library. It has since been discovered that, as bsl::integral_constant
is actually a distinct class template derived from std::integral_constant
, there must always be a distinct bsl
alias template, which will be provided in a future BDE release. Given this new direction, the need for a macro for the native type is obviated so BSLS_LIBRARYFEATURES_HAS_CPP17_BOOL_CONSTANT
is being removed.
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:
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
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.
The BSLS_LIBRARYFEATURES_HAS_CPP17_SPECIAL_MATH_FUNCTIONS
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.
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:
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:
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:
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:
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++ doesn't provide it for the obsolete pre-C++11 CoW string implemetation (_GLIBCXX_USE_CXX11_ABI
== 0).
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:
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:
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.
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:
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 curent version of libc++ supports this feature)
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)
The BSLS_LIBRARYFEATURES_HAS_CPP20_ATOMIC_WAIT_FREE_FUNCTIONS
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)
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)
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:
The BSLS_LIBRARYFEATURES_HAS_CPP20_CALENDAR
is defined if the C++20 Calendar/TZ feature is available in bsl::chrono
namespace.
This macro is defined if the standard __cpp_lib_chrono
feature-test macro has at least 201907L
value.
This macro is defined first for the following compiler versions:
(no current version of GCC or clang supports this feature)
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
The BSLS_LIBRARYFEATURES_HAS_CPP20_IS_LAYOUT_COMPATIBLE
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)
The BSLS_LIBRARYFEATURES_HAS_CPP20_IS_CORRESPONDING_MEMBER
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)
The BSLS_LIBRARYFEATURES_HAS_CPP20_IS_POINTER_INTERCONVERTIBLE
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)
The BSLS_LIBRARYFEATURES_HAS_CPP20_JTHREAD
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:
The BSLS_LIBRARYFEATURES_STDCPP_GNU
macro is defined if the C++ standard library implementation is GNU libstdc++.
The BSLS_LIBRARYFEATURES_STDCPP_IBM
macro is defined if the C++ standard library implementation is IBM's VACPP.
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.
The BSLS_LIBRARYFEATURES_STDCPP_LLVM_LIBCPP
macro is defined if the C++ standard library implementation is LLVM's libc++.
The BSLS_LIBRARYFEATURES_STDCPP_MSVC
macro is defined if the C++ standard library implementation is Microsoft's (Dinkumware based) implementation.
The BSLS_LIBRARYFEATURES_STDCPP_LIBCSTD
macro is defined if the C++ standard library implementation is a RogueWave implementation.
The BSLS_LIBRARYFEATURES_STDCPP_STLPORT
macro is defined if the C++ standard library implementation is an STLPort implementation.
In this section we show intended usage of this component.
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
.
Then, we declare the methods that will be unconditionally provided by our utility component:
Now, we conditionally define an interface that returns a bsl::type
, 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.
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
#define BSLS_LIBRARYFEATURES_DETECTION_IN_PROGRESS |
#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.
#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.
#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.
#define BSLS_LIBRARYFEATURES_LINKER_CHECK_NAME bsls_libraryfeatures_CPP11_ABI |
|
extern |