Questions tagged [constant-expression]

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

Filter by
Sorted by
Tagged with
5
votes
1answer
109 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
84 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
52 views

C++ compile time counter/accumulator [closed]

I could not find a compile time counter/accumulator to achieve something like the following: ...
2
votes
1answer
112 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 ...
10
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 ...
1
vote
0answers
383 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 ...
6
votes
1answer
472 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 ...