Can I Reference Previous Members of an Initializer List?

Question

Say I want to refer to a member of an initializer_list that I already defined. Can I do it?

This code compiles and gives the expected: “13 55 ” in both Visual Studio and gcc, I’d just like to know that it’s legal:

<br />
<code>const int foo[2] = {13, foo[0] + 42};</code>
in progress 0
Aohan 3 months 0 Answers 155 views 0

Leave an answer

Browse
Browse

Captcha Click on image to update the captcha .