You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The readme says it's possible to use the containers with std::vector instead of std::deque. However, after changing that in ordered_set.h, the following code crashes under GCC 7.2.0, probably due to the strange specialization of std::vector<bool>.
Is this the reason why std::deque is used by default? I've found that std::vector makes the containers somewhat faster (though they're much faster than the default unordered containers in STL anyway).
The text was updated successfully, but these errors were encountered:
The main reason to use std::deque as default is that it allows faster rehashes as we don't have to move all the values when growing the container.
Is there any special reason to use a tsl::ordered_set<bool> as the container will only be able to contain a maximum of two values and doesn't seem really useful at first glance? I suppose it's due to a templated code that use tsl::ordered_set?
Sure, set<bool> isn't very useful. I'm trying to use this library as the implementation of sets and dictionaries in my programming language, and this crash appeared in my tests.
Anyway, I guess this issue is more about the C++'s design flaw regarding std::vector<bool>, and the library works correctly, so feel free to close this. Though it might be worth adding some description in readme about why std::deque was chosen as the default and what are the possible consequences of changing it to std::vector.
The readme says it's possible to use the containers with
std::vector
instead ofstd::deque
. However, after changing that inordered_set.h
, the following code crashes under GCC 7.2.0, probably due to the strange specialization ofstd::vector<bool>
.There is also a warning:
A workaround is to keep
std::deque
just forbool
.Is this the reason why
std::deque
is used by default? I've found thatstd::vector
makes the containers somewhat faster (though they're much faster than the default unordered containers in STL anyway).The text was updated successfully, but these errors were encountered: