rutz::dynamic_block< T > Class Template Reference

A dynamically-allocated array whose size may be changed at runtime. More...

#include <rutz/arrays.h>

Inheritance diagram for rutz::dynamic_block< T >:

Inheritance graph
Collaboration diagram for rutz::dynamic_block< T >:

Collaboration graph

List of all members.

Public Types

typedef T value_type
 STL value type.
typedef T * pointer
 STL pointer type.
typedef const T * const_pointer
 STL const pointer type.
typedef T & reference
 STL reference type.
typedef const T & const_reference
 STL const reference type.
typedef pointer iterator
 STL iterator type.
typedef const_pointer const_iterator
 STL const iterator type.
typedef size_t size_type
 STL size type.
typedef ptrdiff_t difference_type
 STL iterator difference type.

Public Member Functions

 dynamic_block (size_type n=0)
 Construct with a given size.
 dynamic_block (const dynamic_block< T > &other)
 Copy construct.
dynamic_block< T > & operator= (const dynamic_block< T > &other)
 Assignment operator.
 ~dynamic_block ()
iterator begin ()
 Iterator to array start.
iterator end ()
 Iterator to array one-past-the-end.
const_iterator begin () const
 Const iterator to array start.
const_iterator end () const
 Const iterator to array one-past-the-end.
reference operator[] (size_type n)
 Unchecked non-const array index.
const_reference operator[] (size_type n) const
 Unchecked const array index.
reference at (size_type n)
 Checked non-const array index (rutz::out_of_range on bounds error).
const_reference at (size_type n) const
 Checked const array index (rutz::out_of_range on bounds error).
size_type size () const
 Size of array.
size_type max_size () const
 Maximum size of array type.
bool is_empty () const
 Query whether size is zero.
void swap (dynamic_block &other)
 Swap with another dynamic_block.
void resize (size_type new_size)
 Resize to a new size.
template<class RandomAccessIterator>
void assign (RandomAccessIterator start, RandomAccessIterator finish)
 Assign from a given iterator range.

Detailed Description

template<class T>
class rutz::dynamic_block< T >

A dynamically-allocated array whose size may be changed at runtime.

Definition at line 350 of file arrays.h.

Member Function Documentation

template<class T>
void rutz::dynamic_block< T >::swap ( dynamic_block< T > &  other  )  [inline]

Swap with another dynamic_block.

This is fast since it only requires swapping the interal pointers to the dynamically-allocated arrays; no element-wise swap is needed.

Definition at line 428 of file arrays.h.

Referenced by rutz::dynamic_block< vec3f >::operator=(), and rutz::dynamic_block< vec3f >::resize().

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

The software described here is Copyright (c) 1998-2005, Rob Peters.
This page was generated Wed Dec 3 06:56:31 2008 by Doxygen version 1.5.5.