Am Mon, 18 Mar 2019 14:10:09 +0000
schrieb Chris Vine <chris@cvine--nospam--.
freeserve.co.uk>:
> On Mon, 18 Mar 2019 14:46:21 +0100
> Ralf Goertz <m...@myprovider.invalid> wrote:
> > Am Mon, 18 Mar 2019 11:01:21 +0000
> > Chris Vine <chris@cvine--nospam--.
freeserve.co.uk> wrote:
> >
> > > A constexpr variable must be a literal type. std::string is not a
> > > literal type. int (and const char* instantiated with a C literal
> > > string) is a literal type. So is a C array of literal types; and
> > > as I understand it also a std::array of literal types, because
> > > std::array is an aggregate type with implicit destructor.
> >
> > I still don't get what you are saying. Assuming the "it" on the
> > penultimate lines is supposed to be an "is", aren't you claiming now
> > that a C array of const char* and array<const char *,int> can both
> > be constexpr?
>
> I am saying that, yes, provided they are initialized by a C string
> literal.
>
> (For what it is worth, the 'it' is correct gramatically - there is an
> implicit repeat of the "so is" from the preceding part of the
> sentence, which is a form of elision which maybe does not exist in
> German.)
Yes, thanks. I shouldn't try to correct a native speaker. After
rereading your sentence I fail to see what was bugging me in the first
place.
> > How does this relate to your previous statement?:
>
> I didn't make a previous statement.
I am sorry, you're right, that was Andy.
> I was answering what I perceived to be your perplexity over the fact
> that std::array<int,n> could be constexpr but
> std::array<std::string,n> could not. If that is not what you meant
> then I don't understand your post.
Actually, I was not perplexed about that. I merely wanted to give
examples of what can and what cannot be constexpr and state that I found
no difference between the two with respect to C and C++ style arrays. My
confusion was and remains to be what Andy said. The answer to you is
irrelevant as I thought I was talking to Andy.