I read that this is an rvalue and we cannot get its address by applying &this.
In my code, I have tried to use a reference binding to this. I'm wondering which way will give the address of this? Or are both wrong?
What exactly is this? An lvalue, an rvalue, a keyword, or something else?
void MyString::test_this() const{
std::cout << "this: " << this << std::endl;
const MyString * const& this_ref = this;
std::cout << "thie_ref: " << &this_ref << std::endl;
const MyString * const&& this_right = this;
std::cout << "thie_right: " << &this_right << std::endl;
}
//this: 00CFFC14
//thie_ref: 00CFFB14
//thie_right: 00CFFAFC