Re: concatenate int value from vector to long long int
Quote:
Originally Posted by
monarch_dodra
Those work for me though, as you can always pass a const expression to functions taking const refs.
uhm, unless I'm missing something, no, because a reference to an automatic const int is not a constant expression ( triggering an implicit capture and hence an error ). Are you using a c++14 standard library ? ( std::max is constexpr from c++14 on ... in this case no error would happen of course )
Re: concatenate int value from vector to long long int
Quote:
Originally Posted by
superbonzo
uhm, unless I'm missing something, no, because a reference to an automatic const int is not a constant expression ( triggering an implicit capture and hence an error ). Are you using a c++14 standard library ? ( std::max is constexpr from c++14 on ... in this case no error would happen of course )
Well, "those work for me" is never proof of anything :) I was using godbolt to test different compiler versions, always with C++11 exclusively (-std=c++11).
Anyways, it would appear gcc accepts the code, for both C++11 and C++14, whereas Clang rejects it for both versions :/