TFLM: use default copy constructor instead of explicit constructor in simple_memory_allocator
This guarantees that all internal states are sync'ed and is future proof - in case a new field is added which can not be easily constructed by the constructor. PiperOrigin-RevId: 314660935 Change-Id: I4bde9e22b04f2abc2819b2c78f4d9c79b3cb5617
This commit is contained in:
parent
dd619e62dc
commit
0aca2efde5
@ -48,8 +48,8 @@ SimpleMemoryAllocator* SimpleMemoryAllocator::Create(
|
||||
// allocator instance.
|
||||
uint8_t* allocator_buffer = tmp.AllocateFromTail(
|
||||
sizeof(SimpleMemoryAllocator), alignof(SimpleMemoryAllocator));
|
||||
return new (allocator_buffer)
|
||||
SimpleMemoryAllocator(error_reporter, tmp.head_, tmp.tail_);
|
||||
// Use the default copy constructor to populate internal states.
|
||||
return new (allocator_buffer) SimpleMemoryAllocator(tmp);
|
||||
}
|
||||
|
||||
SimpleMemoryAllocator::~SimpleMemoryAllocator() {}
|
||||
|
Loading…
Reference in New Issue
Block a user