Unofficial OpenGL Software Development Kit  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
List of all members
refs::array_ref< T > Class Template Reference

#include <array_ref.h>

template<typename T>
class refs::array_ref< T >

A constant reference to an array.

This class represents a constant reference to an array of values. It is not a container. Containers have storage, and array_ref does not manage the storage for anything.

The idea is that you use array_ref in function interfaces, rather than std::vector. Why? So that the user has the freedom to use C-style arrays, boost::array, or any number of other array-like classes to manage their memory. A function that takes array_ref quite simply does not care how the user is managing the memory; it just wants an array of stuff.

This serves as a happy medium between giving the user the freedom to use any possible container by using a range+template, and forcing the user to use exactly and only one container type.

This version of array_ref can be implicitly constructed from:

They can also be constructed from a pointer + a size.

This class fulfills all of the requirements for a sequential range in C++. It's iterators are random-access iterators, and in fact are pointers. It's interface works effectively like that of std::vector, except that it only provides const access to its members.

The only mutating operations allowed on this type are clearing and removing elements from the front/back of the array.

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