mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 19:53:34 +08:00
Optimized Array<>::clear()
This commit is contained in:
@@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user