llvm.org GIT mirror llvm / 6632f95
Added "getRoot()" to ImmutableMap. Made the ctor for ImmutableMap to construct a map from an AVL tree public. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45756 91177308-0d34-0410-b5e6-96231b3b80d8 Ted Kremenek 12 years ago
1 changed file(s) with 12 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
5151 template
5252 typename ValInfo = ImutKeyValueInfo >
5353 class ImmutableMap {
54 public:
5455 typedef typename ValInfo::value_type value_type;
5556 typedef typename ValInfo::value_type_ref value_type_ref;
5657 typedef typename ValInfo::key_type key_type;
5758 typedef typename ValInfo::key_type_ref key_type_ref;
5859 typedef typename ValInfo::data_type data_type;
5960 typedef typename ValInfo::data_type_ref data_type_ref;
60
61 private:
62 typedef ImutAVLTree TreeTy;
61 typedef ImutAVLTree TreeTy;
62
63 private:
6364 TreeTy* Root;
64
65 ImmutableMap(TreeTy* R) : Root(R) {}
66
65
6766 public:
67 /// Constructs a map from a pointer to a tree root. In general one
68 /// should use a Factory object to create maps instead of directly
69 /// invoking the constructor, but there are cases where make this
70 /// constructor public is useful.
71 explicit ImmutableMap(TreeTy* R) : Root(R) {}
6872
6973 class Factory {
7074 typename TreeTy::Factory F;
110114 bool operator!=(ImmutableMap RHS) const {
111115 return Root && RHS.Root ? Root->isNotEqual(*RHS.Root) : Root != RHS.Root;
112116 }
117
118 TreeTy* getRoot() const { return Root; }
113119
114120 bool isEmpty() const { return !Root; }
115121