提交 07bb4139 编写于 作者: Y Yu Yang

Revert changes

上级 da757696
...@@ -110,10 +110,6 @@ class Vector { ...@@ -110,10 +110,6 @@ class Vector {
T* end() { return size() == 0 ? &EmptyDummy() : &this->operator[](size()); } T* end() { return size() == 0 ? &EmptyDummy() : &this->operator[](size()); }
const T* cbegin() const { return begin(); }
const T* cend() const { return end(); }
T& front() { return *begin(); } T& front() { return *begin(); }
T& back() { T& back() {
...@@ -125,10 +121,15 @@ class Vector { ...@@ -125,10 +121,15 @@ class Vector {
const T* begin() const { const T* begin() const {
return size() == 0 ? &EmptyDummy() : &this->operator[](0); return size() == 0 ? &EmptyDummy() : &this->operator[](0);
} }
const T* end() const { const T* end() const {
return size() == 0 ? &EmptyDummy() : &this->operator[](size()); return size() == 0 ? &EmptyDummy() : &this->operator[](size());
} }
const T* cbegin() const { return begin(); }
const T* cend() const { return end(); }
const T& back() const { const T& back() const {
auto it = end(); auto it = end();
--it; --it;
...@@ -244,10 +245,8 @@ class Vector { ...@@ -244,10 +245,8 @@ class Vector {
// implicit cast operator. Vector can be cast to std::vector implicitly. // implicit cast operator. Vector can be cast to std::vector implicitly.
operator std::vector<T>() const { operator std::vector<T>() const {
std::vector<T> result; std::vector<T> result;
if (size() != 0) { result.resize(size());
result.resize(size()); std::copy(begin(), end(), result.begin());
std::copy(begin(), end(), result.begin());
}
return result; return result;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册