ocean.util.container.MallocArray

A utility for allocating and managing malloc allocated arrays.

The module contains functions which aids in creating arrays whose buffer is allocated by malloc().

Note: - Don't manually modify the length of the arrays returned by this module or pass it to any method which modifies the length of the array.

To resize an array, call the resize() method. To deallocate an array, call the deallocate() method.

Members

Functions

allocate
Item[] allocate(size_t num_elements)

Allocate an array of the given type and length whose buffer is allocated by malloc().

deallocate
void deallocate(Item[] arr_to_deallocate)

Deallocate an array whose buffer was allocated by malloc().

resize
void resize(Item[] arr_to_resize, size_t new_length)

Resize an array whose buffer was allocated by malloc().

testFunctions
void testFunctions()

Basic functionalities tests

Meta

License

Boost Software License Version 1.0. See LICENSE_BOOST.txt for details. Alternatively, this file may be distributed under the terms of the Tango 3-Clause BSD License (see LICENSE_BSD.txt for details).