I am working in C++ and I want to create an initializer list for a struct of array of structs and I keep getting the same compilation error. Here is ...
I am working in C++ and I want to create an initializer list for a struct of array of structs and I keep getting the same compilation error. Here is ...
With the following code: I'm getting compiler error (with -pedantic flag) which complains that zero-size array is not allowed. In my example the ob ...
I have a C++14 project and cannot use C++17 inline variables. Is it possible to get this to work in C++14, or will this only work in C++17? ...
I would like to remove the reliance of #define macros in my code, and I'm unable to achieve the same functionality with constexpr. To be pratical con ...
Maybe it is a trivial question, but I can't actually find an answer. If I have a class like in the example below do I need to provide both const and n ...
The keyword constexpr enforced pretty tight restrictions on functions on its introduction into the C++11 standard. These restrictions were loosened wi ...
I have an extendable collection of classes that have approximately the same interface, that each have a different static constant for serialization pu ...
Is there a way to avoid get_primes_size? Now the process of calculating primes less than 1000 is repeated twice. Like first pushing them to a local s ...
I try to have a member function require a static constexpr boolean member to be true. This would be very helpful to DRY a quite complex requirement. A ...
I want to introduce strong types with error checking at compile time. For my chrono type, I noticed literals are silently narrowed when the underlying ...
Playing around with the Compiler Explorer, I can see that GCC can convert even slightly complex functions into constant values at compile time. For ex ...
example code In practice, This code throws an exception in function 'basic_string_view(const Char* s)', I tried to replace constexpr with const, an ...
I'm generating an constexpr std::array inside of a constexpr class, but I only want one instance of that class over all of the project where it is use ...
I am trying to understand the utility of if constexpr and want to know if there is any utility in using it in this way. Is this function changed at ...
I was trying to compute an array in compilation time to speed up some functions while i encountered an error which I was unable to resolve with the he ...
I struggle to pass any constexpr function as a parameter to the constexpr array computation. How I would do this in a common C++ (not constexpr, just ...
I have an array like this one below: I have to add 2 more bytes that would represent the checksum of the array. The checksum is calculated like thi ...
I know, that such questions were asked early (f.e. non-constexpr calls in constexpr functions), but... Let's take next code: All is ok. We GUARANTE ...
As we know that we can not initialize a variable in any of the case in switch, unless it is the last case of the respective switch, as initialization ...
I'm trying to understand the reason for the compilation error with my CRTP implementation in this example: Specifically why is (A) ok while (B) giv ...