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 ...
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 ...
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:
...
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 ...
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 ...
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 ...
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, ...
3
votes
Accepted
Flatten 2d-array at compiletime
The biggest readability concern, in my opinion, is squashing everything on one line. Compare:
...
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 ...
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 ...
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 ...
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 ...
1
vote
Simple DP problem solved in compile time
Given that the result can be computed as simply as this:
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
c++ × 16constant-expression × 16
c++20 × 6
c++17 × 4
template-meta-programming × 2
c++11 × 1
recursion × 1
hash-map × 1
matrix × 1
c++14 × 1
collections × 1
dynamic-programming × 1
enum × 1
sudoku × 1
circular-list × 1
hashcode × 1
overloading × 1
sfinae × 1
c++23 × 1