Curly braces vrs parenthesis....

Hi,

Given a vector:

vector<complex> wc{ {1.5, -2}, {3.4}, {2.6, 5.13} };

If i call the constructor with {}, I get an error:

assert(wc[0] == complex{ 1.5,-2.0 }); /// ERROR!

whereas creating an object with a name does not (like so:)

complex c{ 1.5, -2.0 };

if I change the curly braces for parenthesis it works, like so:

assert(wc[0] == complex( 1.5,-2.0 ));

Why is this? Why are curly braces giving me problems in some circumstances and not on others?

I am using visual Studio 2015 Update 2...


Thanks,
Juan
Topic archived. No new replies allowed.