Because modifying a variable declared to be const
is undefined behavior, literally anything can happen.
More Related Contents:
- c++ push reference node to stl list
- How come a non-const reference cannot bind to a temporary object?
- Why can’t I make a vector of references?
- Is const_cast safe?
- Return type of ‘?:’ (ternary conditional operator)
- Is the practice of returning a C++ reference variable evil?
- Why are references not reseatable in C++
- Is there any way to find the address of a reference?
- C++: const reference, before vs after type-specifier
- how does the ampersand(&) sign work in c++? [duplicate]
- Difference between pointer and reference as thread parameter
- Difference between pointer to a reference and reference to a pointer
- What’s the meaning of * and & when applied to variable names?
- exit() call inside a function which should return a reference
- why reference size is always 4 bytes – c++
- Why does storing references (not pointers) in containers in C++ not work?
- Difference between returning reference vs returning value C++
- How can I change the variable to which a C++ reference refers?
- warning: returning reference to temporary
- Why can’t I do polymorphism with normal variables?
- what is return type of assignment operator?
- Why doesn’t reference-to-member exist in C++?
- Dangling references and undefined behavior
- 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)