Is there 'byte' data type in C++?

后端 未结 8 491
耶瑟儿~
耶瑟儿~ 2020-12-04 14:33

If exists is there header file to include?

This code give compilation error:

#include 

using namespace std;

int main()
{
    byte b         


        
8条回答
  •  有刺的猬
    2020-12-04 14:45

    Using C++11 there is a nice version for a manually defined byte type:

    enum class byte : std::uint8_t {};
    

    That's at least what the GSL does.

    Starting with C++17 (almost) this very version is defined in the standard as std::byte (thanks Neil Macintosh for both).

提交回复
热议问题