5 votes
Accepted

Enabling bitset-like behavior for enum classes (C++20)

Simplify is_bitmask Since you are using C++20 anyway, you can avoid making is_bitmask a ...
G. Sliepen's user avatar
  • 50.7k
5 votes
Accepted

Compile-time Matrix Class

Stylistically, I'd prefer to see requires-clauses (like noexcept-clauses and trailing return types) indented. That is, where you ...
Quuxplusone's user avatar
  • 19.3k
4 votes

constexpr hash function

Your code is too complex. With C++17, you can write more complex constexpr functions, so you don't need the variadic template tricks: ...
G. Sliepen's user avatar
  • 50.7k
4 votes

Check array contains element at compile time

You have to compare values char by char, or even simpler change const char* to std::string_view make your code work. Thanks to ...
Calak's user avatar
  • 2,323
3 votes

Row-sparse constexpr 2D array, generated at compile-time from array coordinate/value entries

Passing the definitions list as a regular parameter Due to the need to count up the rows to determine how large of an arena is needed at compile-time, I couldn't find a way to avoid passing the ...
G. Sliepen's user avatar
  • 50.7k
3 votes
Accepted

Check array contains element at compile time

With C++20's consteval this is now possible without static_assert or macro's. Solution based on C++20 to eliminate runtime bugs ...
Synck's user avatar
  • 191
3 votes

Compiletime (constexpr) Differential Equation System Description for use in Optimal Control

Your code is too complicated I know ODEs, I know what control systems are, but sadly I have to say that knowing this doesn't make your code any easier to understand. I would not want to use this code, ...
G. Sliepen's user avatar
  • 50.7k
3 votes
Accepted

Flatten 2d-array at compiletime

The biggest readability concern, in my opinion, is squashing everything on one line. Compare: ...
L. F.'s user avatar
  • 9,456
3 votes
Accepted

C++ ring buffer using some C++ 17 and coming C++ 20 std::span

After some searching I found that my ring buffer is broken if its capacity isn't power of 2, because once the counter reaches its maximum (on 64-bit : 2^64 - 1) it will begin from zero the next ...
dev65's user avatar
  • 303
3 votes
Accepted

A cartesian product of tuples in C++17

You actually hint at the primary concern with your note about std::make_tuple(), std::tuple_cat() and gradually building up the ...
Deduplicator's user avatar
  • 18.9k
3 votes
Accepted

Constexpr unit tests and asserts

I've also been messing around with making everything constexpr, then using static_asserts in addition to regular unit tests to ...
indi's user avatar
  • 10.3k
3 votes

Two constexpr ceil functions

You have misspelt the typenames from <cstdint> (they are all in the std namespace; it's a portability error to assume they ...
Toby Speight's user avatar
2 votes
Accepted

type erased pointer to member function callable and SFINAE

What I thought is I could call an overloaded function from Callable::Invoke, which resolves to the correct implementation. I would overload a private Callable::Invoke__ function, and use SFINAE or ...
Quuxplusone's user avatar
  • 19.3k
1 vote

Simple DP problem solved in compile time

Given that the result can be computed as simply as this: ...
papagaga's user avatar
  • 5,747

Only top scored, non community-wiki answers of a minimum length are eligible