This type declares a built-in box-function.
Besides mandatory parameter self, implementations expect a reference to an allocator of type MonoAllocator. With that, a deep copy of the boxed object can be allocated.
The function is provided for use-cases where boxes have to "survive" the end of the life-cycle of the original object.
A default implementation of this function is provided. While this just does nothing for non-array types, with array types, the complete contents of the array is cloned. With this in place, all boxed character arrays (strings) are cloned. This is done regardless if it is necessary or not. For example, if the boxed string was created from a C++ string literal, a deep copy is unnecessary. While this imposes a little overhead, there is no way to avoid this because the origin of a boxed array cannot be determined.
Definition at line 334 of file functions.inl.
Public Type Index: | |
using | Signature = void (*) ( boxing::Box& self, MonoAllocator& allocator ) |
using Signature = void (*) ( boxing::Box& self, MonoAllocator& allocator ) |
Signature of the box-function.
self | The mutable box that the function was invoked on. |
allocator | A monotonic allocator that may be used for cloning. |
Definition at line 340 of file functions.inl.