Questions tagged [constant-expression]

Use this whenever compile-time expression is implemented (currently exists in C++ and D). Do not use this tag if the compile-time evaluation property is achieved through template metaprogramming in C++ (in which case use the [template-meta-programming] tag).

Filter by
Sorted by
Tagged with
2
votes
1answer
119 views

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

When I heard about the new Linux I/O interface io_uring I searched about the ring buffer. I then thought I may replace my safe queue which is base on C++ 11 ...
5
votes
1answer
258 views

A cartesian product of tuples in C++17

I would like to write a function that computes a cartesian product of two tuples in C++17 (the tuples can be of type std::tuple or ...
3
votes
1answer
89 views

Simple DP problem solved in compile time

The problem is taken from one of recent SO questions: Finding max sum of matrix elements with following constraints: Exactly one row element has to be included in the sum If element at (i, j) is ...
3
votes
0answers
213 views

C++ compile time counter/accumulator [closed]

I could not find a compile time counter/accumulator to achieve something like the following: ...
3
votes
1answer
399 views

Check array contains element at compile time

We have a modifyCoefficient(const char* name, int value) function that updates the value of a coefficient in a container. The names are known at compile time, they ...
6
votes
1answer
749 views

Constexpr unit tests and asserts

I'm trying out some different programming styles to experiment with the new C++ concepts. Within the experiment I was looking into how constexpr could be helpful ...
1
vote
0answers
485 views

constexpr hashtable string to user type

This creates something like constexpr mar<String, T> using C++14. Collision resolution is with static_assert and manually ...
11
votes
1answer
2k views

User defined literal for std::integral_constant

I created a user defined literal _c to convert an "integer" literal into an std::integral_constant. Basically, the goal is to ...