Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c++.moderated    |    Moderated discussion of C++ superhackery    |    33,346 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 32,234 of 33,346    |
|    =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to All    |
|    Re: Why no conversion from std::initiali    |
|    02 May 12 23:08:06    |
      From: daniel.kruegler@googlemail.com              Am 02.05.2012 21:12, schrieb Ivan Godard:       > I see that there needs to be a constexpr size() for initializer lists,       > and actually I'd thought that there was one - perhaps this should be       > added independently of my proposal, because I can see other places in       > which it might be useful.              Yes, certainly.              > However, I don't understand why "ls" has to be constexpr in your example       > (or rather, why ars needs a constexpr initializer). Yes, the compiler       > needs to save the values on the list at run time rather than than at       > compile time, but it does that anyway. And surely the compiler can       > subscript the ls list (even though the programmer cannot) to get the       > values to use to initialize the ars elements with. I'm ignorant here -       > why constexpr?              This is a definition problem: What you are intending (quite reasonably) is a       partial constant expression: The size needs to be a constant expression, but       not necessarily the contents of the referenced array. How to specify the state       of this? I'm not        saying that this would be impossible, but it requires some special wording to       make that possible. The good news are that this wording needs only be applied       to std::initializer_list (which is a "magic" type anyway), but I still       consider this as        problematic. Note that there are currently no restrictions of st       ::initializer_list objects compared to other objects. This means, you can       legally declare a variable without initializing it with data, like so:              std::initializer_list |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca