Why is the bitrate implemented by the template?

To define a 16-bit bit, it will look like this:

std::bitset<16> bs(0x123);

If I create a class of bits, I will probably do this:

mine::bitset bs(16, 0x123);

Is there a reason std :: bitset is implemented by the template?

Is this a good model that we should apply in some situations?

+4
source share
1 answer

Is there a reason std :: bitset is implemented by the template? Is this a good model that we should apply in some situations?

std::bitset . , , . , boost::dynamic_bitset. , std::array std::vector, .

+4

Source: https://habr.com/ru/post/1523494/


All Articles