vector_of_iterator.h
Go to the documentation of this file.
#ifndef _RHEO_VECTOR_OF_ITERATOR_H
#define _RHEO_VECTOR_OF_ITERATOR_H
//
// vector_of_iterator returns:
// iterator when begin()
// const_iterator when begin() const
// and so.
//
#include "get_pointer_from_iterator.h"
namespace rheolef {
template<class T>
class vector_of_iterator
: public std::vector<T*>
{
public:
typedef std::vector<T*> V;
typedef std::vector<const T*> CONST_V;
typedef T* value_type;
typedef const T* const_value_type;
typedef value_type* iterator;
typedef const_value_type*const const_iterator;
typedef value_type& reference;
typedef const value_type& const_reference;
#ifdef TODO
// pointer do not have rbegin and rend with p++ that goes back...
typedef value_type* reverse_iterator;
#endif // TODO
typedef typename V::size_type size_type;
typedef typename V::difference_type difference_type;
#ifdef TODO
typedef typename CONST_V::const_reference const_reference;
#endif // TODO
explicit vector_of_iterator (size_type n = 0, const value_type& value = value_type ());
#ifdef TODO
vector_of_iterator (const_iterator first, const_iterator last);
#endif // TODO
size_type size() const;
iterator begin();
const_iterator begin() const;
const_iterator end () const;
iterator end ();
const_reference operator[] (size_type i) const;
reference operator[] (size_type i);
#ifdef TODO
const_reverse_iterator rbegin() const;
reverse_iterator rbegin();
const_reverse_iterator rend() const;
reverse_iterator rend();
public:
const_reference at (size_type n) const;
reference at (size_type n);
const_reference front () const;
reference front ();
const_reference back () const;
reference back ();
#endif // TODO
};
template<class T>
inline
vector_of_iterator<T>::vector_of_iterator (
size_type n,
const value_type& value)
: std::vector<value_type>(n,value)
{
}
#ifdef TODO
template<class T>
inline
vector_of_iterator<T>::vector_of_iterator (
const_iterator first,
const_iterator last)
: std::vector<T*>(first,last)
{
}
#endif // TODO
template<class T>
inline
typename vector_of_iterator<T>::size_type
vector_of_iterator<T>::size() const
{
return std::vector<value_type>::size();
}
template<class T>
inline
typename vector_of_iterator<T>::iterator
vector_of_iterator<T>::begin()
{
return get_pointer_from_iterator(std::vector<value_type>::begin());
}
template<class T>
inline
typename vector_of_iterator<T>::const_iterator
vector_of_iterator<T>::begin() const
{
return const_iterator(get_pointer_from_iterator(std::vector<value_type>::begin()));
}
template<class T>
inline
typename vector_of_iterator<T>::iterator
vector_of_iterator<T>::end()
{
return begin()+size();
}
template<class T>
inline
typename vector_of_iterator<T>::const_iterator
vector_of_iterator<T>::end() const
{
return begin()+size();
}
#ifdef TODO
template<class T>
inline
typename vector_of_iterator<T>::reverse_iterator
vector_of_iterator<T>::rbegin()
{
return get_pointer_from_iterator(std::vector<T>::rbegin());
}
template<class T>
inline
typename vector_of_iterator<T>::const_reverse_iterator
vector_of_iterator<T>::rbegin() const
{
return get_pointer_from_iterator(std::vector<T>::rbegin());
}
template<class T>
inline
typename vector_of_iterator<T>::reverse_iterator
vector_of_iterator<T>::rend()
{
return get_pointer_from_iterator(std::vector<T>::rend());
}
template<class T>
inline
typename vector_of_iterator<T>::const_reverse_iterator
vector_of_iterator<T>::rend() const
{
return get_pointer_from_iterator(std::vector<T>::rend());
}
#endif // TODO
template<class T>
inline
typename vector_of_iterator<T>::const_reference
vector_of_iterator<T>::operator[] (size_type i) const
{
return *(begin()+i);
}
template<class T>
inline
typename vector_of_iterator<T>::reference
vector_of_iterator<T>::operator[] (size_type i)
{
return *(begin()+i);
}
#ifdef TODO
template<class T>
inline
typename vector_of_iterator<T>::const_reference
vector_of_iterator<T>::at (size_type n) const
{
return const_reference(std::vector<value_type>::operator[] (n));
}
template<class T>
inline
typename vector_of_iterator<T>::reference
vector_of_iterator<T>::at (size_type n)
{
return const_reference(std::vector<value_type>::operator[] (n));
}
template<class T>
inline
typename vector_of_iterator<T>::const_reference
vector_of_iterator<T>::front () const
{
return const_reference(std::vector<value_type>::front());
}
template<class T>
inline
typename vector_of_iterator<T>::reference
vector_of_iterator<T>::front ()
{
return const_reference(std::vector<value_type>::front());
}
template<class T>
inline
typename vector_of_iterator<T>::const_reference
vector_of_iterator<T>::back () const
{
return const_reference(std::vector<value_type>::back());
}
template<class T>
inline
typename vector_of_iterator<T>::reference
vector_of_iterator<T>::back ()
{
return const_reference(std::vector<value_type>::back());
}
#endif // TODO
} // namespace rheolef
#endif // _RHEO_VECTOR_OF_ITERATOR_H
get_pointer_from_iterator.h
rheolef::vector_of_iterator::size
size_type size() const
Definition: vector_of_iterator.h:103
rheolef::vector_of_iterator::size_type
V::size_type size_type
Definition: vector_of_iterator.h:49
rheolef::value
rheolef::std value
rheolef::vector_of_iterator::vector_of_iterator
vector_of_iterator(size_type n=0, const value_type &value=value_type())
Definition: vector_of_iterator.h:84
rheolef::vector_of_iterator::reference
value_type & reference
Definition: vector_of_iterator.h:43
rheolef::vector_of_iterator::CONST_V
std::vector< const T * > CONST_V
Definition: vector_of_iterator.h:38
rheolef::vector_of_iterator::const_iterator
const_value_type *const const_iterator
Definition: vector_of_iterator.h:42
rheolef::vector_of_iterator::const_reference
const typedef value_type & const_reference
Definition: vector_of_iterator.h:44
rheolef::vector_of_iterator::difference_type
V::difference_type difference_type
Definition: vector_of_iterator.h:50
rheolef::vector_of_iterator
Definition: vector_of_iterator.h:33
rheolef::value_type
result_type value_type
Definition: field_expr_recursive.h:499
rheolef::vector_of_iterator::end
const_iterator end() const
Definition: vector_of_iterator.h:124
rheolef::vector_of_iterator::begin
iterator begin()
Definition: vector_of_iterator.h:110
rheolef::get_pointer_from_iterator
std::iterator_traits< Iterator >::pointer get_pointer_from_iterator(Iterator iter)
Definition: get_pointer_from_iterator.h:26
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
rheolef::vector_of_iterator::const_value_type
const typedef T * const_value_type
Definition: vector_of_iterator.h:40
rheolef::const_iterator
Definition: field_expr_recursive.h:552
rheolef::vector_of_iterator::iterator
value_type * iterator
Definition: vector_of_iterator.h:41
rheolef::space_constant::vector
@ vector
Definition: space_constant.h:137
mkgeo_ball.n
n
Definition: mkgeo_ball.sh:150
rheolef::vector_of_iterator::operator[]
const_reference operator[](size_type i) const
Definition: vector_of_iterator.h:169
size_type
field::size_type size_type
Definition: branch.cc:425
rheolef::vector_of_iterator::value_type
T * value_type
Definition: vector_of_iterator.h:39
rheolef::vector_of_iterator::V
std::vector< T * > V
Definition: vector_of_iterator.h:37
rheolef::std
Definition: vec_expr_v2.h:391
T
Expr1::float_type T
Definition: field_expr.h:218