Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Is there any clause in the Standard allowing this?

$
0
0

Apparently this is allowed by the language.

#include <iostream>

int main()
{
    int&& r = 10;
    r += 1;
    std::cout << r << '\n';
}
The code prints 11, and the literal 10 can't be altered. Isn't r a reference to the constant 10?


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>