|
-
February 8th, 2016, 03:22 PM
#16
Re: concatenate int value from vector to long long int
 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 )
-
February 8th, 2016, 03:48 PM
#17
Re: concatenate int value from vector to long long int
 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 :/
Is your question related to IO?
Read this C++ FAQ article at parashift by Marshall Cline. In particular points 1-6.
It will explain how to correctly deal with IO, how to validate input, and why you shouldn't count on "while(!in.eof())". And it always makes for excellent reading.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|