Skip to content

Instantly share code, notes, and snippets.

@LucianoPAlmeida
Last active December 29, 2021 02:04
Show Gist options
  • Save LucianoPAlmeida/2550fca8a776c81432eb73ee6896d342 to your computer and use it in GitHub Desktop.
Save LucianoPAlmeida/2550fca8a776c81432eb73ee6896d342 to your computer and use it in GitHub Desktop.
size_t val = 0;
// val expression is l-value
val = 1;
size_t fn() { // ... }
// Result of fn call expr is an r-value
fn();
//It cannot be an l-value
fn() = val; // compilation error
size_t& fn_ref() { // ... }
//It is an l-value
fn_ref() = val; // allowed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment