mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-13 19:03:33 +08:00
Optimized array initialization
This commit is contained in:
@@ -122,7 +122,11 @@ private:
|
||||
BufferType data_;
|
||||
|
||||
template <typename U>
|
||||
typename EnableIf<sizeof(U(0) == U())>::Type initialize(int) { std::fill(data_, data_ + MaxSize, U()); }
|
||||
typename EnableIf<sizeof(U(0) == U())>::Type initialize(int)
|
||||
{
|
||||
if (ArrayMode != ArrayModeDynamic)
|
||||
std::fill(data_, data_ + MaxSize, U());
|
||||
}
|
||||
template <typename> void initialize(...) { }
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user