braced-init-list Questions

2

In the following if I use constexpr the compiler apparently the compiler says "expression must have a constant value", this happens on MSVC and GCC: int main() { constexpr auto nnn = { ...
Puberulent asked 19/9, 2024 at 7:56

1

Solved

Related question: Calling an explicit constructor with a braced-init list: ambiguous or not? The question is similar to 1 and 2, but not the same. #include <type_traits> #include <vect...
Honoria asked 12/2, 2024 at 3:57

2

Solved

I need to define a C++ template that accepts several 3D coordinates as their parameters. When all dimensions of these coordinates are defined as separate integer variables, the parameter list would...

1

I can concisely (with braces) initialize 5 out of 6 of the following cases: of copyable of move-only array YES YES std::array YES YES std::vector YES NO The one case that doe...
Fabri asked 14/8, 2023 at 7:6

1

Solved

I have a faint memory of reading that code like int x[4] = {}; used to initialize a struct/array to default values is relying on a non standard (but widespread) extension that first appeared ...
Disagree asked 13/12, 2014 at 17:53
1

© 2022 - 2025 — McMap. All rights reserved.