Public Types | Public Member Functions
ash::table_element_adaptor< Table > Class Template Reference

An adaptor for lazy insertions into a sparse table. More...

#include <ash/impl/sparse_group.h>

List of all members.

Public Types

typedef Table::value_type value_type
typedef Table::size_type size_type
typedef Table::reference reference
typedef Table::pointer pointer

Public Member Functions

 table_element_adaptor (Table *tbl, size_type i)
 Constructor.
reference operator= (const value_type &val)
 Assignment from a value_type - insert the value.
 operator value_type ()
 Cast to value_type.
pointer operator& ()
 Address operator.

Detailed Description

template<class Table>
class ash::table_element_adaptor< Table >

An adaptor for lazy insertions into a sparse table.

Parameters:
TableThe container type.

A sparse table does not actually allocate memory for entries that are not filled. Because of this, it becomes complicated to have a non-const iterator: we don't know, if the iterator points to a not-filled bucket, whether you plan to fill it with something or whether you plan to read its value (in which case you'll get the default bucket value). Therefore, while we can define const operations in a pretty 'normal' way, for non-const operations, we define something that returns a helper object with operator= and operator& that allocate a bucket lazily. We use this for table[] and also for regular table iterators.


Constructor & Destructor Documentation

template<class Table >
ash::table_element_adaptor< Table >::table_element_adaptor ( Table *  tbl,
size_type  i 
) [inline]

Constructor.

Parameters:
tblA pointer to the container.
iThe index of the element.

Member Function Documentation

template<class Table >
ash::table_element_adaptor< Table >::operator value_type ( ) [inline]

Cast to value_type.

template<class Table >
pointer ash::table_element_adaptor< Table >::operator& ( ) [inline]

Address operator.

template<class Table >
reference ash::table_element_adaptor< Table >::operator= ( const value_type &  val) [inline]

Assignment from a value_type - insert the value.


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


© 2012   AshTL
Licensed under  AGPLv3
Hosted by  Get AshTL at SourceForge.net. Fast, secure and Free Open Source software downloads
Generated by  doxygen 1.7.4