Aspect-oriented programming in C++

Aspect-oriented programming (AOP) is a way of implementing new class features without changing class code. For example for adding logging to selected classes. It implements code separation in different way than in other paradigms like OOP.

There is a hard way of doing this - with help of pre-compiler like AspectC++.

There are several other ways (workarounds) for implementing it in standard C++:

  • Curiously Recurring Template (see links below)
  • Execute-Around Pointer
  • policy-based design (which is similar, but not the same as aspects), see Template metaprogramming which allows you to implement zero-cost optional method parts

Aspects - articles

Aspects - solutions