[mpl] calling a function depending on availability of *this
Dear all, I am trying to create an assertion macro which can be used inside and outside of class member functions. When inside a class, I want it to be able to use information from *this, which obviously does not exist outside of a class member function. Right now, I have two different macros and I would like to unify the API. The situation is actually more complex but boils down to the following question: How can I create a macro (#define) such that its definition does different things when inside a class member function than outside. Something like: if exists(*this) assertion(a, *this); else assertion(a); such that this is resolved to either of the assertion() overloads at compile time. I guess this is the domain of MPL, but my head just doesn't work in MPL-terms (yet). I would appreciate if someone gave me a solution to this case and promise to try to work my way into MPL more with it. -- martin; (greetings from the heart of the sun.) \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck invalid/expired pgp subkeys? use subkeys.pgp.net as keyserver! spamtraps: madduck.bogus@madduck.net "arguments are extremely vulgar, for everyone in good society holds exactly the same opinion." -- oscar wilde
participants (1)
-
martin f krafft