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 ...
  • 19.2k
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: ...
  • 38.3k
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 ...
  • 2,293
4 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 ...
  • 38.3k
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 ...
  • 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, ...
  • 38.3k
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 ...
  • 9,431
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 ...
  • 18.2k
3 votes
Accepted

Flatten 2d-array at compiletime

The biggest readability concern, in my opinion, is squashing everything on one line. Compare: ...
  • 9,269
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 ...
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 ...
  • 19.2k
2 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 ...
  • 293
1 vote

Simple DP problem solved in compile time

Given that the result can be computed as simply as this: ...
  • 5,697

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