Contents
Memory utilities

Overview

This header provides memory utility functions, defined within the Balau::Util::Memory namespace.

Quick start

#include <Balau/Util/Memory.hpp>

The following utilities are currently implemented. More information is available on the API documentation page.

Pointer containers

These functions provide variadic conversions from a set of input arguments to a vector of pointer containers, via a supplied transform function. Functions are available for shared and unique pointer containers.

There are two versions of the functions. The first version works with a transform function that transforms an argument into a single pointer. The second version works with a transform function that transforms an argument into a vector or pointers.

These functions are quite specialised and specific to the Balau library's internal implementation. For example, the makeSharedV function is used in the injector implementation in order to create the binding builders from each supplied configuration object in the variadic createBindings call.

			auto builders = Memory::makeSharedV<ApplicationConfiguration, Impl::BindingBuilderBase>(
				[] (const ApplicationConfiguration & conf) { return conf.createBuilders(); }
				, conf ...
			);
		

These functions may however be useful when a similar variadic transform functionality is required in application code.

Function name Description
makeShared Create a vector of shared pointers after transforming the arguments (scalar transform version).
makeSharedV Create a vector of shared pointers after transforming the arguments (vector transform version).
makeUnique Create a vector of unique pointers after transforming the arguments (scalar transform version).
makeUniqueV Create a vector of unique pointers after transforming the arguments (vector transform version).