rpa::container_traits< Container > Struct Template Reference

For a container type, gives some type information. More...

#include <common.h>

List of all members.

Public Types

typedef Container::const_reference const_reference
typedef Container::const_iterator const_iterator
typedef Container::iterator iterator
typedef std::back_insert_iterator<
Container > 
insertion_iterator
typedef Container::value_type value_type
typedef true_t limit_t
 For debugging only.

Static Public Member Functions

static iterator begin (Container &aC)
static const_iterator begin_const (const Container &aC)
static iterator end (Container &aC)
static const_iterator end_const (const Container &aC)
static bool is_not_begin (const Container &aC, iterator aEnd)
 Used to know whether we must flush a buffer of this type.
static size_t ressz (const Container &aC, const_iterator aEnd)
 Returns the smallest number but bigger or equal to a container's size.
static size_t max_size (void)
 We should in fact return the exact value a container will return.
static void clear (Container &aCont)
static ptrdiff_t distance (const Container &aC)
 Not the size, but the distance between begin and end. Should be equal, but...
static insertion_iterator begout (Container &aCont)


Detailed Description

template<class Container>
struct rpa::container_traits< Container >

For a container type, gives some type information.

This allows to process the same way, plain STL containers, and C-language arrays.


Member Typedef Documentation

template<class Container>
typedef Container::const_iterator rpa::container_traits< Container >::const_iterator

template<class Container>
typedef Container::const_reference rpa::container_traits< Container >::const_reference

template<class Container>
typedef std::back_insert_iterator< Container > rpa::container_traits< Container >::insertion_iterator

template<class Container>
typedef Container::iterator rpa::container_traits< Container >::iterator

template<class Container>
typedef true_t rpa::container_traits< Container >::limit_t

For debugging only.

template<class Container>
typedef Container::value_type rpa::container_traits< Container >::value_type


Member Function Documentation

template<class Container>
static iterator rpa::container_traits< Container >::begin ( Container &  aC  )  [inline, static]

template<class Container>
static const_iterator rpa::container_traits< Container >::begin_const ( const Container &  aC  )  [inline, static]

template<class Container>
static insertion_iterator rpa::container_traits< Container >::begout ( Container &  aCont  )  [inline, static]

template<class Container>
static void rpa::container_traits< Container >::clear ( Container &  aCont  )  [inline, static]

template<class Container>
static ptrdiff_t rpa::container_traits< Container >::distance ( const Container &  aC  )  [inline, static]

Not the size, but the distance between begin and end. Should be equal, but...

template<class Container>
static iterator rpa::container_traits< Container >::end ( Container &  aC  )  [inline, static]

template<class Container>
static const_iterator rpa::container_traits< Container >::end_const ( const Container &  aC  )  [inline, static]

template<class Container>
static bool rpa::container_traits< Container >::is_not_begin ( const Container &  aC,
iterator  aEnd 
) [inline, static]

Used to know whether we must flush a buffer of this type.

We cannot simply used the size of such a container, because a fixed-size array has no size - but we have the last pointer filled by the algorithm. More : We use already-allocated container where the algorithm simply rewrites over existing elements. Therefore, we must compare the latest used iterator with the actual beginning of the container.

template<class Container>
static size_t rpa::container_traits< Container >::max_size ( void   )  [inline, static]

We should in fact return the exact value a container will return.

template<class Container>
static size_t rpa::container_traits< Container >::ressz ( const Container &  aC,
const_iterator  aEnd 
) [inline, static]

Returns the smallest number but bigger or equal to a container's size.

ressz is used to return in constant time, the smallest possible number, but bigger or equal to the container's size. This number is used to reserve memory for copying. What is necessary is to copy only from the beginning of the container, to the iterator 'aEnd', not the end of the container. Avoids at all price any operation in linear time. For this, prefers a bit of temporary memory waste.

We could probably use 'iterator_in' : It does the same.


The documentation for this struct was generated from the following file:
Generated on Tue Sep 25 10:20:34 2007 for rpa by  doxygen 1.4.7