XLE  v0.02.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Utility::DynamicArray< Type, Deletor > Class Template Reference

Wrapper for std::unique_ptr<Type[]> More...

#include <PtrUtils.h>

Public Types

typedef Type value_type
 

Public Member Functions

Type * begin () never_throws
 
Type * end () never_throws
 
size_t size () const never_throws
 
Type & operator[] (size_t index) never_throws
 
bool empty () never_throws
 
const Type * begin () const never_throws
 
const Type * end () const never_throws
 
const Type & operator[] (size_t index) const never_throws
 
Type * get () never_throws
 
const Type * get () const never_throws
 
std::unique_ptr< Type[]> release () never_throws
 
 DynamicArray (std::unique_ptr< Type[], Deletor > &&elements, size_t count) never_throws
 
template<typename OtherDeletor >
 DynamicArray (DynamicArray< Type, OtherDeletor > &&moveFrom) never_throws
 
template<typename OtherDeletor >
DynamicArrayoperator= (DynamicArray< Type, OtherDeletor > &&moveFrom) never_throws
 
template<typename OtherDeletor >
DynamicArray< Type, Deletor > & operator= (DynamicArray< Type, OtherDeletor > &&moveFrom) never_throws
 

Static Public Member Functions

static DynamicArray< Type, Deletor > Copy (const DynamicArray< Type, Deletor > &copyFrom)
 

Detailed Description

template<typename Type, typename Deletor = std::default_delete<Type[]>>
class Utility::DynamicArray< Type, Deletor >

Wrapper for std::unique_ptr<Type[]>

This is a just a basic wrapper for a heap-allocated array and a count value, with a STL container like interface. The only real advantage over using a std::vector<> is if the array has already been allocated through some other means (for example, by using the array form of std::make_unique). For other cases, std::vector<> should be sufficient. One advantage is the copy operations are disabled (except if explicitly using DynamicArray::Copy). This prevent accidental copies where a move is intended.


The documentation for this class was generated from the following file: