summaryrefslogtreecommitdiff
path: root/src/expr/node_value.h
diff options
context:
space:
mode:
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