Optimized Array<>::clear()

This commit is contained in:
Pavel Kirienko
2014-02-25 15:44:07 +04:00
parent af00efade2
commit e4530daa2d
@@ -95,6 +95,8 @@ public:
} }
SizeType capacity() const { return MaxSize; } SizeType capacity() const { return MaxSize; }
void clear() { size_ = 0; }
}; };
/** /**
@@ -240,7 +242,7 @@ class Array : public ArrayImpl<T, ArrayMode, MaxSize_>
int decodeImpl(ScalarCodec& codec, const TailArrayOptimizationMode tao_mode, TrueType) /// Dynamic int decodeImpl(ScalarCodec& codec, const TailArrayOptimizationMode tao_mode, TrueType) /// Dynamic
{ {
StaticAssert<IsDynamic>::check(); StaticAssert<IsDynamic>::check();
clear(); Base::clear();
if (isOptimizedTailArray(tao_mode)) if (isOptimizedTailArray(tao_mode))
{ {
while (true) while (true)
@@ -320,8 +322,6 @@ public:
} }
} }
void clear() { resize(0); }
template <typename R> template <typename R>
bool operator==(const R& rhs) const bool operator==(const R& rhs) const
{ {