diff options
author | cathook <b01902109@csie.ntu.edu.tw> | 2014-06-19 07:25:48 +0800 |
---|---|---|
committer | cathook <b01902109@csie.ntu.edu.tw> | 2014-06-19 07:25:48 +0800 |
commit | fe926756145c5e5cf5f315af0acdbfd85ba27543 (patch) | |
tree | 4d75f94b87fd6d60262f2377d92f5896faf1be7d /meowpp/oo/ObjArray.h | |
parent | b2b55d8c642524274d8115d5b1863e1a40715887 (diff) | |
download | meow-fe926756145c5e5cf5f315af0acdbfd85ba27543.tar meow-fe926756145c5e5cf5f315af0acdbfd85ba27543.tar.gz meow-fe926756145c5e5cf5f315af0acdbfd85ba27543.tar.bz2 meow-fe926756145c5e5cf5f315af0acdbfd85ba27543.tar.lz meow-fe926756145c5e5cf5f315af0acdbfd85ba27543.tar.xz meow-fe926756145c5e5cf5f315af0acdbfd85ba27543.tar.zst meow-fe926756145c5e5cf5f315af0acdbfd85ba27543.zip |
x
Diffstat (limited to 'meowpp/oo/ObjArray.h')
-rw-r--r-- | meowpp/oo/ObjArray.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/meowpp/oo/ObjArray.h b/meowpp/oo/ObjArray.h index 4417524..b58b89c 100644 --- a/meowpp/oo/ObjArray.h +++ b/meowpp/oo/ObjArray.h @@ -37,19 +37,19 @@ private: public: ObjArray(): self(true) { } - + ObjArray(ObjArray const& a): self(false) { self().copyFrom(a.self); } - + ObjArray(std::vector<T> const& a): self(true) { self()->array_ = a; } - + ObjArray(size_t sz, T const& e): self(true) { self()->array_.resize(sz, e); } - + ~ObjArray() { } @@ -79,7 +79,7 @@ public: self()->array_.resize(res); return size(); } - + void clear() { self()->array_.clear(); } @@ -96,7 +96,7 @@ public: self()->array_.push_back(e); return entry(size() - 1); } - + bool popBack() { if (empty()) return false; self()->array_.pop_back(); @@ -106,11 +106,11 @@ public: ObjArray& operator=(ObjArray const& a) { return copyFrom(a); } - + T const& operator[](size_t i) const { return self->array_[i]; } - + T& operator[](size_t i) { return self()->array_[i]; } @@ -128,7 +128,7 @@ public: } return true; } - + bool read(FILE* f, bool bin, unsigned int fg) { size_t sz; if (bin) { @@ -143,19 +143,19 @@ public: } return true; } - + ObjBase* create() const { return new ObjArray(); } - + ObjBase* copyFrom(ObjBase const* b) { return &(copyFrom(*b)); } - + char const* ctype() const { return typeid(*this).name(); } - + std::string type() const { return std::string(ctype()); } |