3 #ifndef DUNE_DYNVECTOR_HH 4 #define DUNE_DYNVECTOR_HH 31 template<
class K,
class Allocator >
37 typedef typename container_type::size_type
size_type;
40 template<
class K,
class Allocator >
53 template<
class K,
class Allocator = std::allocator< K > >
56 std::vector< K, Allocator > _data;
70 explicit DynamicVector(size_type n,
const allocator_type &a = allocator_type() ) :
71 _data( n, value_type(), a )
75 DynamicVector( size_type n, value_type
c,
const allocator_type &a = allocator_type() ) :
81 Base(), _data(x._data)
86 _data(
std::move(x._data))
91 _data(x.begin(), x.end(), x.get_allocator())
99 const size_type n = x.
size();
101 for( size_type i =0; i<n ;++i)
102 _data.push_back( x[ i ] );
105 using Base::operator=;
117 _data = std::move(other._data);
128 return _data.capacity();
130 void resize (size_type n, value_type c = value_type() )
140 size_type
vec_size()
const {
return _data.size(); }
156 template<
class K,
class Allocator >
size_type vec_size() const
Definition: dynvector.hh:140
Base::value_type value_type
Definition: dynvector.hh:61
T real_type
export the type representing the real type of the field
Definition: ftraits.hh:27
std::istream & operator>>(std::istream &is, tuple< T1 > &t)
Read a tuple.
Definition: tuples.hh:203
DynamicVector(size_type n, value_type c, const allocator_type &a=allocator_type())
Constructor making vector with identical coordinates.
Definition: dynvector.hh:75
size_type capacity() const
Number of elements for which memory has been allocated.
Definition: dynvector.hh:126
DynamicVector(const DynamicVector &x)
Constructor making vector with identical coordinates.
Definition: dynvector.hh:80
container_type::size_type size_type
Definition: dynvector.hh:37
DynamicVector & operator=(const DynamicVector &other)
Copy assignment operator.
Definition: dynvector.hh:108
Construct a vector with a dynamic size.
Definition: dynvector.hh:30
Traits::size_type size_type
The type used for the index access and size operation.
Definition: densevector.hh:265
void reserve(size_type n)
Definition: dynvector.hh:134
DynamicVector(DynamicVector &&x)
Move constructor.
Definition: dynvector.hh:85
DynamicVector< K, Allocator > derived_type
Definition: dynvector.hh:34
DynamicVector(const DynamicVector< T, Allocator > &x)
Definition: dynvector.hh:90
const K & vec_access(size_type i) const
Definition: dynvector.hh:142
Implements a generic iterator class for writing stl conformant iterators.
Implements the dense vector interface, with an exchangeable storage class.
FieldTraits< K >::field_type field_type
Definition: dynvector.hh:43
Definition: ftraits.hh:22
char c
Definition: alignment.hh:33
A few common exception classes.
DynamicVector(size_type n, const allocator_type &a=allocator_type())
Definition: dynvector.hh:70
DynamicVector & operator=(DynamicVector &&other)
Move assignment operator.
Definition: dynvector.hh:115
DynamicVector(const allocator_type &a=allocator_type())
Constructor making uninitialized vector.
Definition: dynvector.hh:66
Traits::value_type value_type
export the type representing the field
Definition: densevector.hh:256
Definition: matvectraits.hh:29
FieldTraits< K >::real_type real_type
Definition: dynvector.hh:44
Interface for a class of dense vectors over a given field.
Definition: densevector.hh:18
Base::size_type size_type
Definition: dynvector.hh:60
size_type size() const
size method
Definition: densevector.hh:296
std::vector< K, Allocator > container_type
Definition: dynvector.hh:35
K value_type
Definition: dynvector.hh:36
T field_type
export the type representing the field
Definition: ftraits.hh:25
DynamicVector(const DenseVector< X > &x, const allocator_type &a=allocator_type())
Copy constructor from another DenseVector.
Definition: dynvector.hh:96
Dune namespace.
Definition: alignment.hh:9
K & vec_access(size_type i)
Definition: dynvector.hh:141
void resize(size_type n, value_type c=value_type())
Definition: dynvector.hh:130
Allocator allocator_type
Definition: dynvector.hh:63