CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    Join Date
    Oct 2008
    Posts
    1,456

    Re: concatenate int value from vector to long long int

    Quote Originally Posted by monarch_dodra View Post
    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 )

  2. #17
    Join Date
    Jun 2009
    Location
    France
    Posts
    2,513

    Re: concatenate int value from vector to long long int

    Quote Originally Posted by superbonzo View Post
    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.

Page 2 of 2 FirstFirst 12

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
  •  





Click Here to Expand Forum to Full Width

Featured