The standard solution to this problem, if it is associated with a programming language, and not with C ++, is to write a custom preprocessor that understands a subset of the language in question and your annotation, rewrites the code with annotations deleted, which is then passed to a real language compiler.
This is the standard method when it comes to expanding languages: adding a preprocessing step to the compiler.
Unfortunately, it is almost impossible to simply parse a C ++ function; C ++ source code processing almost always ends with the creation of a full AST generator, due to the fact that some of them are tedious for analyzing language features.
Take a look at these ads:
template<bool b, class T> void foo(T &t){if(b) T.do_this(); else T.do_that();}
class foobar { public: virtual void do_this(); virtual void do_that(); };
class barfoo : public foobar { public: virtual void do_this(); virtual void do_that(); };
and now this function
void bar(float l){ barfoo t; foo<fsqrt(l) > 1, foobar>(t); }
, , . , , .
, : MOC Qt, , : ++, . Qt , MOC.
++ .