c++11 - Why isn't std::array's operator==() marked constexpr? -


it's very natural want compare std::array's @ compile time; , operator==() constexpr'able. yet - isn't marked constexpr. intentional or oversight? , - what's reason left way (apparently in c++17 well)?

p0031 explained why didn't propose constexpr comparisons:

currently comparisons , swap/fill may implemented of algorithms <algorithm> header. marking comparisons constexpr break ability , potentially lead performance degradations.

for example, == can implemented in terms of std::equal, - in appropriate cases - can call highly-optimized-but-decidedly-not-constexpr memcmp. making constexpr == rule out optimization without special compiler assistance.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -