Advertisement
SepandMeenu

C++: Bind non-const lvalue reference

Jul 29th, 2019
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.20 KB | None | 0 0
  1. int main() {
  2.     int i = 1, j = 2;
  3.  
  4.     const int& m = i + j;  // compiles
  5.     int& n = i + j;  // compile error: cannot bind non-const lvalue reference of type ... to an rvalue of type ...
  6.  
  7.     return 0;
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement