diff options
author | Nathan Binkert <nate@binkert.org> | 2008-10-10 21:45:35 -0700 |
---|---|---|
committer | Nathan Binkert <nate@binkert.org> | 2008-10-10 21:45:35 -0700 |
commit | 89f016aacbe92f90c1af98678043f2f6fc82c364 (patch) | |
tree | c67f5b5ad84f12877feeb428d24df8afc64a5ca7 /src/base | |
parent | 1f57193439925d2098052d0648031dc04b1ad440 (diff) | |
download | gem5-89f016aacbe92f90c1af98678043f2f6fc82c364.tar.xz |
cprintf: properly deal with pointer types
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/varargs.hh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/base/varargs.hh b/src/base/varargs.hh index f307e58d1..4328f2057 100644 --- a/src/base/varargs.hh +++ b/src/base/varargs.hh @@ -147,6 +147,20 @@ struct Any : public Base<RECV> } }; +template <typename T, class RECV> +struct Any<T *, RECV> : public Base<RECV> +{ + const T *argument; + + Any(const T *arg) : argument(arg) {} + + virtual void + add_arg(RECV &receiver) const + { + receiver.add_arg(argument); + } +}; + template <class RECV> struct Argument : public RefCountingPtr<Base<RECV> > { @@ -156,6 +170,8 @@ struct Argument : public RefCountingPtr<Base<RECV> > Argument(const Null &null) { } template <typename T> Argument(const T& arg) : Base(new Any<T, RECV>(arg)) { } + template <typename T> + Argument(const T* arg) : Base(new Any<T *, RECV>(arg)) { } void add_arg(RECV &receiver) const |