mirror of
https://github.com/MaskRay/ccls.git
synced 2025-06-07 16:54:54 +00:00
Fix for ccls:Vec not building with MVS
This commit is contained in:
parent
fd48f6928e
commit
8fd48f4549
13
src/utils.hh
13
src/utils.hh
@ -143,7 +143,7 @@ public:
|
|||||||
|
|
||||||
template <typename T> struct Vec {
|
template <typename T> struct Vec {
|
||||||
std::unique_ptr<T[]> a;
|
std::unique_ptr<T[]> a;
|
||||||
int s;
|
int s = 0;
|
||||||
const T *begin() const { return a.get(); }
|
const T *begin() const { return a.get(); }
|
||||||
T *begin() { return a.get(); }
|
T *begin() { return a.get(); }
|
||||||
const T *end() const { return a.get() + s; }
|
const T *end() const { return a.get() + s; }
|
||||||
@ -151,5 +151,16 @@ template <typename T> struct Vec {
|
|||||||
int size() const { return s; }
|
int size() const { return s; }
|
||||||
const T &operator[](size_t i) const { return a.get()[i]; }
|
const T &operator[](size_t i) const { return a.get()[i]; }
|
||||||
T &operator[](size_t i) { return a.get()[i]; }
|
T &operator[](size_t i) { return a.get()[i]; }
|
||||||
|
Vec &operator=(Vec &&rhs) {
|
||||||
|
a = std::move(rhs.a);
|
||||||
|
s = rhs.s;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
Vec(const Vec &lhs) : a(std::make_unique<T[]>(lhs.s)), s(lhs.s) {
|
||||||
|
std::copy(lhs.begin(), lhs.end(), begin());
|
||||||
|
s = lhs.s;
|
||||||
|
}
|
||||||
|
Vec(std::unique_ptr<T[]> &&a_, int size) : a(std::move(a_)), s(size) {}
|
||||||
|
Vec(){};
|
||||||
};
|
};
|
||||||
} // namespace ccls
|
} // namespace ccls
|
||||||
|
Loading…
Reference in New Issue
Block a user