jeudi 10 novembre 2022

When does c++ right value destruct in this scenario?

Here is the code:

class SomeType {
public:
SomeType() {}
~SomeType() {}

std::string xxx;
}
bool funtion_ab() {
    SomeType(); // This is a right val; 
    // The right val destructs here when I test the code. I want to make sure that it would always destructs here.
    int a = 0, b = 10;
    ....// other code
    return true; 
} 

Please tell me if you know the truth. Thank you!

Aucun commentaire:

Enregistrer un commentaire