I've got a local variable inside a function:
vector<extend_t> newExtends( extend_alloc_t( alloc ) );
Unfortunately it gets recognized as a function definition. How do I prevent that ?
CodePudding user response:
Simple solution: Use copy-initialization with =
instead, as in:
auto newExtends = std::vector<extend_t>( extend_alloc_t( alloc ) );
[Note that actual copying should be elided]
CodePudding user response:
You can use{}
std::vector<extend_t> newExtends = std::vector<extend_t>{extend_alloc_t(alloc)};