mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-14 23:48:56 +00:00
allow TinyPtrVector to implicitly convert to ArrayRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145898 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bae56b4c21
commit
266451dd95
@ -37,6 +37,15 @@ public:
|
|||||||
delete V;
|
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 {
|
bool empty() const {
|
||||||
// This vector can be empty if it contains no element, or if it
|
// This vector can be empty if it contains no element, or if it
|
||||||
// contains a pointer to an empty vector.
|
// contains a pointer to an empty vector.
|
||||||
|
Loading…
Reference in New Issue
Block a user