forked from OSchip/llvm-project
allow TinyPtrVector to implicitly convert to ArrayRef.
llvm-svn: 145898
This commit is contained in:
parent
52f24d7a32
commit
654d054705
|
@ -37,6 +37,15 @@ public:
|
|||
delete V;
|
||||
}
|
||||
|
||||
// implicit conversion operator to ArrayRef.
|
||||
operator ArrayRef<EltTy>() const {
|
||||
if (Val.isNull())
|
||||
return ArrayRef<EltTy>();
|
||||
if (Val.template is<EltTy>())
|
||||
return *Val.template getAddrOf<EltTy>();
|
||||
return *Val.template get<VecTy*>();
|
||||
}
|
||||
|
||||
bool empty() const {
|
||||
// This vector can be empty if it contains no element, or if it
|
||||
// contains a pointer to an empty vector.
|
||||
|
|
Loading…
Reference in New Issue