Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
josuttis_nm_c20_the_complete_guide.pdf
Скачиваний:
44
Добавлен:
27.03.2023
Размер:
5.85 Mб
Скачать

23.6 <version>

693

If all scalar types have a size of 1, then std::endian::little, std::endian::big, and std::endian::native all have the same value.

The type is defined in the header file <bit>.

As enumeration values, these values can be used at compile time. For example:

#include <bit>

...

if constexpr (std::endian::native == std::endian::big) {

... // handle big-endian

}

else if constexpr (std::endian::native == std::endian::little) {

...

// handle little-endian

}

 

else {

 

...

// handle mixed endian

}

 

23.6 <version>

C++20 introduces a new header file <version>. This header file provides no active functionality. Instead, it provides all implementation-specific general information about the C++ standard library being used.

For example, <version> might contain:

The version and release date of the C++ standard library

Copyright information

In addition, <version> defines the feature test macros of the C++ standard library (they are also defined in the header files they apply to).

Because this header file is short and fast to load, tools can include this header file to get all necessary information to make decisions based on the feature set provided or find all information they need to deal with general information of the library used.