Solved: init bool array

In the 'Prime' thread was a question about initializing an array of type bool, see http://www.cplusplus.com/forum/beginner/250568/#msg1103476

The tutorials (see http://www.cplusplus.com/doc/tutorial/arrays/) say
"Both these statements are equivalent:"
1
2
int foo[] = { 10, 20, 30 };
int foo[] { 10, 20, 30 }; 


In M$VS2010 I tried
1
2
bool a[n] { };
bool x[n] = { };

Only the later one is accepted.
Is there anything you want us to discuss or is this just a note to people that still use pre-C++11 compilers?
Is there anything you want us to discuss

No. Ah.. yes.

First it is a reply to an unanswered question from another thread. A hint only.

Second, yes, how is it possible to get just the opposite, the complete array initialized with true?
vector<bool> x( n, true );
or
valarray<bool> x( true, n );

No idea why someone chose to make those a different way round.
Last edited on
Thank you.
Topic archived. No new replies allowed.