summaryrefslogtreecommitdiff
path: root/src/expr/node_value.h
diff options
context:
space:
mode:
authorDejan Jovanović <dejan.jovanovic@gmail.com>2010-09-21 17:33:06 +0000
committerDejan Jovanović <dejan.jovanovic@gmail.com>2010-09-21 17:33:06 +0000
commitea9346f840046ee20558afb2a17dd5999d45c5c9 (patch)
tree96f657b2f5790407025c7d99d27d0eb3e6708eda /src/expr/node_value.h
parent2fa76743be4d68dbbaa54069ef91b7066ba22543 (diff)
iterators for tim, begin<PLUS>() and end<PLUS>() should give him what he wants
Diffstat (limited to 'src/expr/node_value.h')
-rw-r--r--src/expr/node_value.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/expr/node_value.h b/src/expr/node_value.h
index 3c21777ed..63121b981 100644
--- a/src/expr/node_value.h
+++ b/src/expr/node_value.h
@@ -187,6 +187,12 @@ public:
template <typename T>
inline iterator<T> end() const;
+ template <typename T, Kind kind>
+ inline iterator<T> begin() const;
+
+ template <typename T, Kind kind>
+ inline iterator<T> end() const;
+
/**
* Hash this NodeValue. For hash_maps, hash_sets, etc.. but this is
* for expr package internal use only at present! This is likely to
@@ -356,6 +362,22 @@ inline NodeValue::iterator<T> NodeValue::end() const {
return iterator<T>(d_children + d_nchildren);
}
+template <typename T, Kind kind>
+inline NodeValue::iterator<T> NodeValue::begin() const {
+ if (d_kind != kind) return iterator<T>(this);
+ NodeValue* const* firstChild = d_children;
+ if(getMetaKind() == kind::metakind::PARAMETERIZED) {
+ ++firstChild;
+ }
+ return iterator<T>(firstChild);
+}
+
+template <typename T, Kind kind>
+inline NodeValue::iterator<T> NodeValue::end() const {
+ if (d_kind != kind) return iterator<T>(this + 1);
+ return iterator<T>(d_children + d_nchildren);
+}
+
inline bool NodeValue::isBeingDeleted() const {
return NodeManager::currentNM() != NULL &&
NodeManager::currentNM()->isCurrentlyDeleting(this);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback