Add 2x constructors for TinyPtrVector, one that takes in one elemenet and the other that takes in an ArrayRef<EltTy>

Currently one can only construct an empty TinyPtrVector. These are just missing
elements of the API.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225055 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Michael Gottesman
2014-12-31 23:33:24 +00:00
parent 4ba553c0f3
commit 69338a993e
2 changed files with 33 additions and 0 deletions

View File

@@ -96,6 +96,13 @@ public:
return *this;
}
/// Constructor from a single element.
explicit TinyPtrVector(EltTy Elt) : Val(Elt) {}
/// Constructor from an ArrayRef.
explicit TinyPtrVector(ArrayRef<EltTy> Elts)
: Val(new VecTy(Elts.begin(), Elts.end())) {}
// implicit conversion operator to ArrayRef.
operator ArrayRef<EltTy>() const {
if (Val.isNull())