mattreecebentley / plf_colony

An unordered C++ data container providing fast iteration/insertion/erasure while maintaining pointer/iterator validity to non-erased elements regardless of insertions/erasures. Provides higher-performance than std:: library containers for high-modification scenarios with unordered data.
https://plflib.org/colony.htm
zlib License
398 stars 33 forks source link

if in blank() should be constexpr #20

Closed CaptainCrowbar closed 5 years ago

CaptainCrowbar commented 5 years ago

MSVC 2017 with /W4 /WX complains about the constant condition on line 1039 of plf_colony.h. It suggests changing the plain if to if constexpr, and I agree.

mattreecebentley commented 5 years ago

I tried all that. (a) It makes no difference to performance, (b) some compilers don't support constexpr and it's a pain to maintain and (c) MSVC2017 doesn't fully support constexpr yet, despite it's warning at W4, which is the reason why it hasn't been implemented.

mattreecebentley commented 5 years ago

Ended up implementing constexpr across the board, as it turns out MSVC have fixed their previous constexpr issues, but mainly cause it allowed me to fix a problem with moveable-but-non-copyable types.