#ifndef __Trace_ah__
#define __Trace_ah__

#include <iostream>
using namespace std;

template <int I> struct ArgPrinter {
  template <class JP> static inline void work (JP &tjp) {
    ArgPrinter<I - 1>::work (tjp);
    cout << "Arg " << I << ": " << *tjp.template arg<I - 1> () << endl;
  }
};

template <> struct ArgPrinter<0> {
  template <class JP> static inline void work (JP &tjp) {}
};

aspect Trace {
  template <class JP> void print_args (JP &tjp) {
    ArgPrinter<JP::ARGS>::work (tjp);
  }
  advice call("% A::%(...)") : before()  {
    tjp->arg<0>();
    print_args (*tjp); 
  }
};

#endif // __Trace_ah__




