24 #ifndef SKA_CHEETAH_DATA_VECTORLIKE_H 25 #define SKA_CHEETAH_DATA_VECTORLIKE_H 28 #include <type_traits> 43 template <
typename VectorType>
49 typedef typename VectorType::iterator Iterator;
50 typedef typename VectorType::const_iterator ConstIterator;
51 typedef typename VectorType::reverse_iterator ReverseIterator;
52 typedef typename VectorType::pointer Pointer;
53 typedef typename VectorType::const_pointer ConstPointer;
54 typedef typename VectorType::reference Reference;
55 typedef typename VectorType::const_reference ConstReference;
56 typedef typename VectorType::value_type ValueType;
57 typedef typename VectorType::allocator_type AllocatorType;
75 template<
typename... Args>
76 explicit VectorLike(std::size_t n, Args&&... args);
84 explicit VectorLike(std::size_t n,
const ValueType& value, AllocatorType
const& allocator=AllocatorType());
90 std::size_t
size()
const;
95 ValueType
const&
front()
const;
101 ValueType
const&
back()
const;
109 void resize(std::size_t size,
const ValueType &x = ValueType());
127 ConstReference
operator[](std::size_t n)
const;
141 ConstIterator
begin()
const;
142 ConstIterator cbegin()
const;
163 ConstIterator
end()
const;
170 ConstIterator
cend()
const;
176 ReverseIterator
rend();
190 ConstPointer
data()
const;
204 template<
typename ...Args>
212 void reserve(std::size_t size);
226 void swap(VectorLike &v);
231 Iterator
erase(Iterator pos);
233 Iterator
erase(Iterator first, Iterator last);
238 Iterator
insert(Iterator pos,
const ValueType& value);
240 ConstIterator
insert(ConstIterator pos, ValueType&& value);
242 ConstIterator
insert(ConstIterator pos,
const ValueType& value);
244 Iterator
insert(Iterator pos, ValueType&& value);
246 template<
typename...Args>
247 Iterator emplace(Iterator pos, Args&&...);
249 template<
typename...Args>
250 ConstIterator emplace(ConstIterator pos, Args&&...);
280 #include "cheetah/data/detail/VectorLike.cpp" 282 #endif // SKA_CHEETAH_DATA_VECTORLIKE_H ValueType const & front() const
the first emelment
ValueType const & back() const
the last emelment
void resize(std::size_t size, const ValueType &x=ValueType())
Resize the vector.
Pointer data()
Return a pointer pointing to the start of the vector.
Reference operator[](std::size_t n)
Subscript access to the data contained in the underlying vector.
ConstIterator cend() const
A constant iterator pointing to the end of the vector.
std::size_t size() const
Retrieve the size of the underlying vector.
void emplace_back(Args &&... value)
Appends element to end of vector using the move operator.
Class that wraps objects that export the std::vector interface.
AllocatorType allocator() const
return the allocator
Some limits and constants for FLDO.
void clear()
clear the data
void push_back(ValueType const &value)
Appends element to end of vector.
void reserve(std::size_t size)
Reserve space for this many elements.
void swap(VectorLike &v)
swaps the contents of this vector_base with another vector
ReverseIterator rbegin()
A reverse iterator pointing to the end of the vector (i.e the last element).
VectorLike()
Construct a VectorLike instance.
Iterator end()
An iterator pointing to the end of the vector.
bool empty() const
return true if the vector is empty
std::size_t capacity() const
The reseved size of the vector.
Iterator insert(Iterator pos, const ValueType &value)
insert a value in the vector_base
SelfType & operator+=(SelfType const &)
add the contents of the argument to the current vector
Iterator erase(Iterator pos)
erase the element from a given position or a range of positions
Iterator begin()
An iterator pointing to the start of the vector.