2.2.7.1.7 Array::SetAsOwner

Description

Sets the array to be owner of the Objects memory, when set the object's will be deleted by the array on resize and during destruction

Syntax

BOOL SetAsOwner( BOOL bIsOwner )

Parameters

bIsOwner
[input] A boolean indication if the array should delete (when TRUE) or not on resize

Return

Returns a boolean indicating whether the array was the owner or not (older value)

Examples

EX1

#include <Array.h>
struct PERSON
{
	int nID;
};

void Array_SetAsOwner_ex1()
{
	Array<PERSON&> arp(false);
	if ( arp.IsOwner() )
		printf("Array arp2 should not be the owner of the items in it.");
	
	arp.SetAsOwner(true);
	if ( !arp.IsOwner() )
		printf("Fail to set Array arp as Owner.");
}

Remark

See Also

Array::Array, Array::IsOwner

Header to Include

Array.h