mardi 1 novembre 2016

Make explicit when a struct is truthy or falsy in C++

I have defined a simple struct mystruct in C++. I would like to be able to use

mystruct a; 
// do things to a
if(a) { 
    /* do things */ 
} 

directly. Is there a way for me to define the behavior of this?

Aucun commentaire:

Enregistrer un commentaire