I'm looking for an easy-to-use macro for calling a function only once for a specific value. For example:
void foo( Object* obj )
{
// Print out the name of each object only once
DO_ONCE( obj, printf("This gets printed only once per object! %s\n",obj->GetName()) );
}
Then
Object obj1("obj1Name"),obj2("obj2Name");
foo(&obj1);
foo(&obj1);
foo(&obj2);
Should print out
This gets printed only once per object! obj1Name
This gets printed only once per object! obj2Name