mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Provide an explicit specialization of SmallVector at N=0 which does
not require its type argument to be complete if no members are actually used. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112106 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cd11e9db35
commit
5b5f7260a0
@ -707,6 +707,39 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Specialize SmallVector at N=0. This specialization guarantees
|
||||||
|
/// that it can be instantiated at an incomplete T if none of its
|
||||||
|
/// members are required.
|
||||||
|
template <typename T>
|
||||||
|
class SmallVector<T,0> : public SmallVectorImpl<T> {
|
||||||
|
public:
|
||||||
|
SmallVector() : SmallVectorImpl<T>(0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
explicit SmallVector(unsigned Size, const T &Value = T())
|
||||||
|
: SmallVectorImpl<T>(0) {
|
||||||
|
this->reserve(Size);
|
||||||
|
while (Size--)
|
||||||
|
this->push_back(Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename ItTy>
|
||||||
|
SmallVector(ItTy S, ItTy E) : SmallVectorImpl<T>(0) {
|
||||||
|
this->append(S, E);
|
||||||
|
}
|
||||||
|
|
||||||
|
SmallVector(const SmallVector &RHS) : SmallVectorImpl<T>(0) {
|
||||||
|
if (!RHS.empty())
|
||||||
|
SmallVectorImpl<T>::operator=(RHS);
|
||||||
|
}
|
||||||
|
|
||||||
|
const SmallVector &operator=(const SmallVector &RHS) {
|
||||||
|
SmallVectorImpl<T>::operator=(RHS);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
|
Loading…
Reference in New Issue
Block a user