diff options
author | Josh Stone <jistone@redhat.com> | 2009-08-03 15:20:19 -0700 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-08-03 15:20:19 -0700 |
commit | 3a4235b9897b75a188753419a29f0616c1686249 (patch) | |
tree | bd7c4e67308dca73cf1032e699fe526ad34acbf3 /staptree.h | |
parent | 0164a29cfb80344dced2e1683df05f6b62fe6cb3 (diff) | |
download | systemtap-steved-3a4235b9897b75a188753419a29f0616c1686249.tar.gz systemtap-steved-3a4235b9897b75a188753419a29f0616c1686249.tar.xz systemtap-steved-3a4235b9897b75a188753419a29f0616c1686249.zip |
Strengthen the template types in update_visitor
* staptree.h (update_visitor::require, provide): Make the parameters and
return values a T*, to make it explicit that we want pointer types.
Diffstat (limited to 'staptree.h')
-rw-r--r-- | staptree.h | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -855,21 +855,21 @@ struct throwing_visitor: public visitor struct update_visitor: public visitor { - template <typename T> T require (T src, bool clearok=false) + template <typename T> T* require (T* src, bool clearok=false) { - T dst = NULL; + T* dst = NULL; if (src != NULL) { src->visit(this); assert(!targets.empty()); - dst = static_cast<T>(targets.top()); + dst = static_cast<T*>(targets.top()); targets.pop(); assert(clearok || dst); } return dst; } - template <typename T> void provide (T src) + template <typename T> void provide (T* src) { targets.push(static_cast<void*>(src)); } @@ -915,7 +915,7 @@ private: }; template <> indexable* -update_visitor::require <indexable*> (indexable* src, bool clearok); +update_visitor::require <indexable> (indexable* src, bool clearok); // A visitor which performs a deep copy of the root node it's applied // to. NB: It does not copy any of the variable or function @@ -925,7 +925,7 @@ update_visitor::require <indexable*> (indexable* src, bool clearok); struct deep_copy_visitor: public update_visitor { - template <typename T> static T deep_copy (T e) + template <typename T> static T* deep_copy (T* e) { deep_copy_visitor v; return v.require (e); |