std::deque2< _Ty, _Alloc > Class Template Reference

expanded deque template class More...

#include <deque2.h>

Inheritance diagram for std::deque2< _Ty, _Alloc >:

Inheritance graph
{mbo::CStrList\< std::basic_string \>\n||+ CStrList()\l+ CStrList()\l+ CStrList()\l+ ~CStrList()\l+ ToCStr()\l+ add_if_prefix_match()\l+ operator=()\l+ Explode()\l+ Explode()\l+ ExplodeZZString()\l}{std::deque2\< std::basic_string \>\n||+ limit()\l+ position()\l+ contains()\l+ contains_no()\l+ add_if_new()\l+ operator bool()\l+ sort()\l+ dyn_create()\l}
[legend]
Collaboration diagram for std::deque2< _Ty, _Alloc >:

Collaboration graph
[legend]

List of all members.

Public Types

typedef deque2< _Ty, _Alloc > _Myt
typedef deque< _Ty, _Alloc > _Mybase

Public Member Functions

virtual void limit (size_type _Limit)
pair< size_type, bool > position (const _Ty &_Val) const
bool contains (const _Ty &_Val) const
bool contains_no (const _Ty &_Val) const
virtual bool add_if_new (const _Ty &_Val)
 operator bool ()
void sort ()

Static Public Member Functions

static _Myt __cdecl dyn_create (size_type _Count,...)

Related Functions

(Note that these are not member functions.)

template<class _Ty_a, class _Alloc_a, class _Ty_b, class _Alloc_b>
deque2< _Ty_a, _Alloc_a > & operator+= (deque2< _Ty_a, _Alloc_a > &container, const deque< _Ty_b, _Alloc_b > &values)
template<class _Ty_a, class _Alloc_a, class _Ty_b, class _Alloc_b>
deque2< _Ty_a, _Alloc_a > & operator<< (deque2< _Ty_a, _Alloc_a > &container, const deque< _Ty_b, _Alloc_b > &values)


Detailed Description

template<class _Ty, class _Alloc = allocator<_Ty>>
class std::deque2< _Ty, _Alloc >

expanded deque template class

This specialisation supports:

Note:
deque2, list2 and vector2 are designed to be replaceable by each other and hence have the same access methods. However the main differences of their stl base templates still apply.
Parameters:
_Ty element/value type
_Alloc element/value allocator

Definition at line 65 of file deque2.h.


Member Typedef Documentation

template<class _Ty, class _Alloc = allocator<_Ty>>
typedef deque2<_Ty, _Alloc> std::deque2< _Ty, _Alloc >::_Myt

type abbrevation for this class

Definition at line 68 of file deque2.h.

template<class _Ty, class _Alloc = allocator<_Ty>>
typedef deque<_Ty, _Alloc> std::deque2< _Ty, _Alloc >::_Mybase

type abbrevation for parent class/template

Definition at line 69 of file deque2.h.


Member Function Documentation

template<class _Ty, class _Alloc = allocator<_Ty>>
virtual void std::deque2< _Ty, _Alloc >::limit ( size_type  _Limit  )  [inline, virtual]

Limit does not grow if size() < _Limit as resize() does!

Parameters:
_Limit size limit for vector

Definition at line 75 of file deque2.h.

00078     {
00079         if (size() > _Limit)
00080         {
00081             resize(_Limit);
00082         }
00083     }

template<class _Ty, class _Alloc = allocator<_Ty>>
pair<size_type, bool> std::deque2< _Ty, _Alloc >::position ( const _Ty &  _Val  )  const [inline]

Brute force evaluation of element index in container. -1 is returned if element is not contained.

Parameters:
_Val element to search for
Returns:
  • position of _Val in vector or -1 if _VAL is not element of vector
  • whether or not _Val is element of vector

Definition at line 93 of file deque2.h.

00096     {
00097         size_type _Index = 0;
00098         for (const_iterator iter = begin(); iter != end(); ++iter, ++_Index)
00099         {
00100             if (*iter == _Val)
00101             {
00102                 return pair<size_type, bool>(_Index, true);
00103             }
00104         }
00105         return pair<size_type,bool>(static_cast<size_type>(-1), false);
00106     }

template<class _Ty, class _Alloc = allocator<_Ty>>
bool std::deque2< _Ty, _Alloc >::contains ( const _Ty &  _Val  )  const [inline]

Brute force test to check whether or not a specific value is contained in the vector.

Parameters:
_Val element to check for
Returns:
whether or not _Val is member of the vector

Definition at line 114 of file deque2.h.

Referenced by std::deque2< std::basic_string >::add_if_new().

00117     {
00118         return std::find(begin(), end(), _Val) != end();
00119     }

template<class _Ty, class _Alloc = allocator<_Ty>>
bool std::deque2< _Ty, _Alloc >::contains_no ( const _Ty &  _Val  )  const [inline]

Brute force test to check whether or not a specific value is contained in the vector. The inverted result is returned this can be used for map2 values(check_fun_t) to return a unique list.

Parameters:
_Val element to check for
Returns:
whether or not _Val is new = NOT contained in the vector

Definition at line 128 of file deque2.h.

00131     {
00132         return std::find(begin(), end(), _Val) == end();
00133     }

template<class _Ty, class _Alloc = allocator<_Ty>>
virtual bool std::deque2< _Ty, _Alloc >::add_if_new ( const _Ty &  _Val  )  [inline, virtual]

Add _Val if it is not already contained in the vector Returns wether or not _Val was added

Parameters:
_Val element to add
Returns:
whether _Val was added or already contained

Definition at line 141 of file deque2.h.

00144     {
00145         if (!contains(_Val))
00146         {
00147             push_back(_Val);
00148             return true;
00149         }
00150         return false;
00151     }

template<class _Ty, class _Alloc = allocator<_Ty>>
std::deque2< _Ty, _Alloc >::operator bool (  )  [inline]

Check whether the vector contains any element

Returns:
element cout > 0

Definition at line 157 of file deque2.h.

00158     {
00159         return size() > 0;
00160     }

template<class _Ty, class _Alloc = allocator<_Ty>>
void std::deque2< _Ty, _Alloc >::sort (  )  [inline]

Sort the elements in the deque

See also:
std::sort

Definition at line 166 of file deque2.h.

00167     {
00168         if (size()>1)
00169         {
00170             std::sort(begin(), end());
00171         }
00172     }

template<class _Ty, class _Alloc = allocator<_Ty>>
static _Myt __cdecl std::deque2< _Ty, _Alloc >::dyn_create ( size_type  _Count,
  ... 
) [inline, static]

Dynamic deque creation.

Parameters:
_Count number of elemnts to put into deque2
... elements to put into the vector each of type _Ty (_Count times)
Returns:
the created container.

Definition at line 180 of file deque2.h.

00184     {
00185         _Myt       _Deque;
00186         va_list    _Args;
00187 
00188         va_start(_Args, _Count);
00189         while(_Count--)
00190         {
00191             _Deque.push_back(va_arg(_Args, const _Ty));
00192         }
00193         va_end(_Args);
00194         return _Deque;
00195     }


Friends And Related Function Documentation

template<class _Ty_a, class _Alloc_a, class _Ty_b, class _Alloc_b>
deque2< _Ty_a, _Alloc_a > & operator+= ( deque2< _Ty_a, _Alloc_a > &  container,
const deque< _Ty_b, _Alloc_b > &  values 
) [related]

add (not store) the values of a container to another container

Note:
the receiver container will not be emptied
Warning:
this operator can only be instanciated if a conversion from _Ty_b to _Ty_a exists
See also:
deque2::operator<<
Parameters:
_Ty_a element/value type of receiver container
_Alloc_a element/value allocator of receiver container
_Ty_b element/value type of input container
_Alloc_b element/value allocator of input container
container container that receives th e input values
values container input values
Returns:
modified container

Definition at line 216 of file deque2.h.

00220 {
00221     // NO clear
00222     for (deque2<_Ty_b, _Alloc_b>::const_iterator it = values.begin(); it != values.end(); ++it)
00223     {
00224         container.push_back((_Ty_a)*it);
00225     }
00226     return container;
00227 };

template<class _Ty_a, class _Alloc_a, class _Ty_b, class _Alloc_b>
deque2< _Ty_a, _Alloc_a > & operator<< ( deque2< _Ty_a, _Alloc_a > &  container,
const deque< _Ty_b, _Alloc_b > &  values 
) [related]

store (not add) the values of a container to another containert

Note:
the receiver container will be emptied
Warning:
this operator can only be instanciated if a conversion from _Ty_b to _Ty_a exists
See also:
map2::operator+=
Parameters:
_Ty_a element/value type of receiver container
_Alloc_a element/value allocator of receiver container
_Ty_b element/value type of input container
_Alloc_b element/value allocator of input container
container container that receives th e input values
values container input values
Returns:
modified container

Definition at line 247 of file deque2.h.

00251 {
00252     container.clear();
00253     container += values;
00254     return container;
00255 };


The documentation for this class was generated from the following file:
  Hosted on code.google.com  
© Marcus Börger
Generated on Fri Jan 18 21:21:15 2008 for MBO-lib by doxygen 1.5.4