Re: Question regarding template instantiation of tempory type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Arthur,

If your parameters are constant, then you should put in "T const&" for the parameter type.

If the parameters are being mutated by the function (indicated by the absence of const), then temporaries are supposed to generate an error because mutating a temporary is considered a programming error by the compiler. (There are a few ways to work around this situation, but it takes a little more work on the invocation side of the fence, and involves wrapping the temporary with something that returns a non-const reference to itself.)

HTH,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux