DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Private Attributes
DGtal::IVector< T, TAlloc, usePointers > Class Template Reference

#include <MPolynomial.h>

Collaboration diagram for DGtal::IVector< T, TAlloc, usePointers >:
Collaboration graph
[legend]

Public Types

typedef TAlloc Alloc
typedef std::vector< T, Alloc >
::size_type 
Size

Public Member Functions

 IVector (const Alloc &allocator=Alloc())
 IVector (Size aSize, const Alloc &allocator=Alloc())
 IVector (Size aSize, const T &entry, const Alloc &allocator=Alloc())
Size size () const
void resize (Size aSize, const T &entry=T())
const T & operator[] (Size i) const
T & operator[] (Size i)
const T & back () const
T & back ()
void swap (IVector &v)
Alloc get_allocator () const
Alloc getAllocator () const

Private Attributes

std::vector< T, AllocmyVec

Detailed Description

template<typename T, typename TAlloc = std::allocator<T>, bool usePointers = false>
class DGtal::IVector< T, TAlloc, usePointers >

Next, we want to define the storage class IVector<T, Alloc, usePointers>. It behaves like a subset of std::vector<T>'s capabilities (i.e. access elements, get size, set size, get last element, swap with other storage of same type), but uses std::vector<T*> in case usePointers is true.

The advantage of this approach is that if T is a more complex object, reallocation done with resize() can be very costly.

This generic version is just using std::vector<T>.

Definition at line 721 of file MPolynomial.h.


Member Typedef Documentation

template<typename T , typename TAlloc = std::allocator<T>, bool usePointers = false>
typedef TAlloc DGtal::IVector< T, TAlloc, usePointers >::Alloc

Definition at line 724 of file MPolynomial.h.

template<typename T , typename TAlloc = std::allocator<T>, bool usePointers = false>
typedef std::vector<T, Alloc>::size_type DGtal::IVector< T, TAlloc, usePointers >::Size

Definition at line 725 of file MPolynomial.h.


Constructor & Destructor Documentation

template<typename T , typename TAlloc = std::allocator<T>, bool usePointers = false>
DGtal::IVector< T, TAlloc, usePointers >::IVector ( const Alloc allocator = Alloc())
inline

Definition at line 730 of file MPolynomial.h.

: myVec(allocator)
{}
template<typename T , typename TAlloc = std::allocator<T>, bool usePointers = false>
DGtal::IVector< T, TAlloc, usePointers >::IVector ( Size  aSize,
const Alloc allocator = Alloc() 
)
inline

Definition at line 734 of file MPolynomial.h.

: myVec( aSize, T(), allocator )
{}
template<typename T , typename TAlloc = std::allocator<T>, bool usePointers = false>
DGtal::IVector< T, TAlloc, usePointers >::IVector ( Size  aSize,
const T &  entry,
const Alloc allocator = Alloc() 
)
inline

Definition at line 738 of file MPolynomial.h.

: myVec(aSize, entry, allocator)
{}

Member Function Documentation

template<typename T , typename TAlloc = std::allocator<T>, bool usePointers = false>
const T& DGtal::IVector< T, TAlloc, usePointers >::back ( ) const
inline

Definition at line 762 of file MPolynomial.h.

References DGtal::IVector< T, TAlloc, usePointers >::myVec.

Referenced by DGtal::MPolynomial< 3, Ring >::leading().

{
return myVec.back();
}
template<typename T , typename TAlloc = std::allocator<T>, bool usePointers = false>
T& DGtal::IVector< T, TAlloc, usePointers >::back ( )
inline

Definition at line 767 of file MPolynomial.h.

References DGtal::IVector< T, TAlloc, usePointers >::myVec.

{
return myVec.back();
}
template<typename T , typename TAlloc = std::allocator<T>, bool usePointers = false>
Alloc DGtal::IVector< T, TAlloc, usePointers >::get_allocator ( ) const
inline

Definition at line 777 of file MPolynomial.h.

References DGtal::IVector< T, TAlloc, usePointers >::myVec.

{
return myVec.get_allocator();
}
template<typename T , typename TAlloc = std::allocator<T>, bool usePointers = false>
Alloc DGtal::IVector< T, TAlloc, usePointers >::getAllocator ( ) const
inline

Definition at line 782 of file MPolynomial.h.

References DGtal::IVector< T, TAlloc, usePointers >::myVec.

Referenced by DGtal::MPolynomial< 3, Ring >::getAllocator().

{
return myVec.get_allocator();
}
template<typename T , typename TAlloc = std::allocator<T>, bool usePointers = false>
const T& DGtal::IVector< T, TAlloc, usePointers >::operator[] ( Size  i) const
inline

Definition at line 752 of file MPolynomial.h.

References DGtal::IVector< T, TAlloc, usePointers >::myVec.

{
return myVec[i];
}
template<typename T , typename TAlloc = std::allocator<T>, bool usePointers = false>
T& DGtal::IVector< T, TAlloc, usePointers >::operator[] ( Size  i)
inline

Definition at line 757 of file MPolynomial.h.

References DGtal::IVector< T, TAlloc, usePointers >::myVec.

{
return myVec[i];
}
template<typename T , typename TAlloc = std::allocator<T>, bool usePointers = false>
void DGtal::IVector< T, TAlloc, usePointers >::resize ( Size  aSize,
const T &  entry = T() 
)
inline
template<typename T , typename TAlloc = std::allocator<T>, bool usePointers = false>
Size DGtal::IVector< T, TAlloc, usePointers >::size ( ) const
inline
template<typename T , typename TAlloc = std::allocator<T>, bool usePointers = false>
void DGtal::IVector< T, TAlloc, usePointers >::swap ( IVector< T, TAlloc, usePointers > &  v)
inline

Definition at line 772 of file MPolynomial.h.

References DGtal::IVector< T, TAlloc, usePointers >::myVec.

Referenced by DGtal::MPolynomial< 3, Ring >::swap().

{
myVec.swap( v.myVec );
}

Field Documentation

template<typename T , typename TAlloc = std::allocator<T>, bool usePointers = false>
std::vector<T, Alloc> DGtal::IVector< T, TAlloc, usePointers >::myVec
private

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