I understand that the C++ std::vector
container has an optimization for bool
values, where each element supposedly uses only one bit in memory.
This space optimization of std::vector (bool) is very important for my application and I must prioritize space over time.
However, the vector only has constant time insertion towards elements at the end of the structure. The deque is able to insert and remove from both ends of the structure in O(1) time. Is there an optimization for std::deque<bool>
to only consist of elements that take a single bit of space?
Aucun commentaire:
Enregistrer un commentaire