Is there a 128 bit integer in C++?

后端 未结 7 675
滥情空心
滥情空心 2020-12-01 11:41

I need to store a 128 bits long UUID in a variable. Is there a 128-bit datatype in C++? I do not need arithmetic operations, I just want to easily store and read the value v

7条回答
  •  没有蜡笔的小新
    2020-12-01 12:09

    I would recommend using std::bitset<128> (you can always do something like using UUID = std::bitset<128>;). It will probably have a similar memory layout to the custom struct proposed in the other answers, but you won't need to define your own comparison operators, hash etc.

提交回复
热议问题