This is not possible, and that’s by design. References cannot be rebound.
More Related Contents:
- When to use references vs. pointers
- When should I use the new keyword in C++?
- What is a reference variable in C++?
- How to “return an object” in C++?
- Pointer vs. Reference
- Can we reassign the reference in C++?
- Is null reference possible?
- How does a C++ reference look, memory-wise?
- One VS2010 bug ? Allowing binding non-const reference to rvalue WITHOUT EVEN a warning?
- C++11 auto: what if it gets a constant reference?
- how to initialize a constexpr reference
- Passing references to pointers in C++
- C++: Argument Passing “passed by reference”
- Should I pass an std::function by const-reference?
- C++ auto vs auto&
- What is a dangling reference? [duplicate]
- Is there a platform or situation where dereferencing (but not using) a null pointer to make a null reference will behave badly?
- Two classes that refer to each other
- C++ Return value, reference, const reference
- Confusion about pointers and references in C++
- Returning non-const reference from a const member function
- C++: difference between ampersand “&” and asterisk “*” in function/method declaration?
- dereferencing a pointer when passing by reference
- Use const wherever possible in C++?
- Why isn’t operator overloading for pointers allowed to work?
- C++ strings: [] vs. *
- Rvalues, lvalues and formal definitions
- const reference to a temporary object becomes broken after function scope (life time)
- What does it mean to return a reference?
- STL containers with reference to objects [duplicate]