lundi 6 janvier 2020

How to can a std::array class member be statically asserted to be sorted in c++11?

How can it be asserted, during compile time, that a std::array<uint8_t, 3> class member is sorted? This would allow it to be made const, use a static_assert() and not have to call std::sort() in the constructor.

In c++20 std::is_sorted() has become a constexpr, but is not available for prior versions.

Aucun commentaire:

Enregistrer un commentaire