28 #ifndef WMIXINVECTOR_H
29 #define WMIXINVECTOR_H
35 #include "WStringUtils.h"
72 typedef typename vector_type::pointer
pointer;
92 typedef typename vector_type::iterator
iterator;
134 :
_impl( initial_size, fill_value )
145 template<
class InputIterator >
WMixinVector( InputIterator first, InputIterator last )
146 :
_impl( first, last )
219 _impl.resize( new_size, fill_value );
229 _impl.reserve( new_capacity );
259 return _impl.empty();
279 return _impl.capacity();
289 return _impl.max_size();
299 return _impl.get_allocator();
309 return _impl.begin();
319 return _impl.begin();
349 return _impl.rbegin();
359 return _impl.rbegin();
415 return _impl.at( index );
427 return _impl.at( index );
438 _impl.assign( count, value );
447 template<
class Iter >
void assign( Iter first, Iter last )
449 _impl.assign( first, last );
459 _impl.push_back( value );
479 return _impl.erase( where );
492 return _impl.erase( first, last );
505 return _impl.insert( where, value );
515 template<
class InputIterator >
void insert(
iterator where, InputIterator first, InputIterator last )
517 _impl.insert( where, first, last );
529 _impl.insert( where, count, value );
559 return _impl.front();
569 return _impl.front();
616 return left.
_impl == right;
629 return left == right.
_impl;
656 return left.
_impl != right;
669 return left != right.
_impl;
696 return left.
_impl < right;
709 return left < right.
_impl;
736 return left.
_impl > right;
749 return left > right.
_impl;
776 return left.
_impl <= right;
789 return left <= right.
_impl;
816 return left.
_impl >= right;
829 return left >= right.
_impl;
858 std::swap( left.
asVector(), right );
869 std::swap( left, right.
asVector() );
880 template<
class ValueT >
inline std::ostream& operator<<( std::ostream& os,
const WMixinVector< ValueT >& v )
882 using string_utils::operator<<;
This is taken from OpenSceneGraph <osg/MixinVector> but copy and pasted in order to reduce dependency...
void reserve(size_type new_capacity)
Wrapper around std::vector member function.
WMixinVector(size_type initial_size, const value_type &fill_value=value_type())
Constructs a vector of initial_size size where every emlement has its default value or the given valu...
const_reverse_iterator rbegin() const
Wrapper around std::vector member function.
WMixinVector & operator=(const vector_type &other)
Assignment operator for the appropriate vector type.
reference front()
Wrapper around std::vector member function.
vector_type::iterator iterator
Compares to std::vector type.
void pop_back()
Wrapper around std::vector member function.
friend bool operator!=(const WMixinVector< ValueT > &left, const WMixinVector< ValueT > &right)
Wrapper around std::vector operator.
size_type size() const
Wrapper around std::vector member function.
reference operator[](size_type index)
Wrapper around std::vector member function.
friend bool operator==(const WMixinVector< ValueT > &left, const WMixinVector< ValueT > &right)
Wrapper around std::vector operator.
WMixinVector()
Empty standard constructor.
iterator erase(iterator first, iterator last)
Wrapper around std::vector member function.
friend bool operator<=(const WMixinVector< ValueT > &left, const WMixinVector< ValueT > &right)
Wrapper around std::vector operator.
iterator end()
Wrapper around std::vector member function.
allocator_type get_allocator() const
Returns its allocator.
vector_type::pointer pointer
Compares to std::vector type.
friend bool operator<(const std::vector< ValueT > &left, const WMixinVector< ValueT > &right)
Wrapper around std::vector operator.
void assign(Iter first, Iter last)
Wrapper around std::vector member function.
void push_back(const value_type &value)
Wrapper around std::vector member function.
vector_type::const_pointer const_pointer
Compares to std::vector type.
const_reference back() const
Wrapper around std::vector member function.
virtual ~WMixinVector()
Virtual Destructor.
WMixinVector(const vector_type &other)
Copy constructor for the appropriate vector type.
vector_type::value_type value_type
Compares to std::vector type.
vector_type _impl
Encapsulated internal vector from which derivation is simulated.
const_reverse_iterator rend() const
Wrapper around std::vector member function.
void swap(vector_type &other)
Allow also swap with vectors of an appropriate type.
iterator erase(iterator where)
Wrapper around std::vector member function.
bool empty() const
Wrapper around std::vector member function.
friend bool operator!=(const std::vector< ValueT > &left, const WMixinVector< ValueT > &right)
Wrapper around std::vector operator.
std::vector< ValueT > vector_type
Handy shortcut for the vector type.
friend bool operator<(const WMixinVector< ValueT > &left, const std::vector< ValueT > &right)
Wrapper around std::vector operator.
iterator begin()
Wrapper around std::vector member function.
const_reference front() const
Wrapper around std::vector member function.
reverse_iterator rend()
Wrapper around std::vector member function.
vector_type::difference_type difference_type
Compares to std::vector type.
friend bool operator>(const WMixinVector< ValueT > &left, const WMixinVector< ValueT > &right)
Wrapper around std::vector operator.
const_reference operator[](size_type index) const
Wrapper around std::vector member function.
friend bool operator<(const WMixinVector< ValueT > &left, const WMixinVector< ValueT > &right)
Wrapper around std::vector operator.
void resize(size_type new_size, const value_type &fill_value=value_type())
Wrapper around std::vector member function.
vector_type::const_reverse_iterator const_reverse_iterator
Compares to std::vector type.
vector_type::size_type size_type
Compares to std::vector type.
vector_type::reverse_iterator reverse_iterator
Compares to std::vector type.
friend bool operator>=(const WMixinVector< ValueT > &left, const std::vector< ValueT > &right)
Wrapper around std::vector operator.
vector_type & asVector()
Return this Mixin as its underlying real vector type.
vector_type::allocator_type allocator_type
Compares to std::vector type.
friend bool operator!=(const WMixinVector< ValueT > &left, const std::vector< ValueT > &right)
Wrapper around std::vector operator.
iterator insert(iterator where, const value_type &value)
Wrapper around std::vector member function.
friend bool operator>=(const WMixinVector< ValueT > &left, const WMixinVector< ValueT > &right)
Wrapper around std::vector operator.
const_iterator end() const
Wrapper around std::vector member function.
friend bool operator>=(const std::vector< ValueT > &left, const WMixinVector< ValueT > &right)
Wrapper around std::vector operator.
friend bool operator<=(const std::vector< ValueT > &left, const WMixinVector< ValueT > &right)
Wrapper around std::vector operator.
friend bool operator==(const WMixinVector< ValueT > &left, const std::vector< ValueT > &right)
Wrapper around std::vector operator.
WMixinVector(InputIterator first, InputIterator last)
Constructs a new vector out of an iterator of another vector.
size_type max_size() const
Wrapper around std::vector member function.
const_iterator begin() const
Wrapper around std::vector member function.
WMixinVector(const WMixinVector &other)
Copy constructor for the WMixinVector itself.
friend bool operator<=(const WMixinVector< ValueT > &left, const std::vector< ValueT > &right)
Wrapper around std::vector operator.
friend bool operator==(const std::vector< ValueT > &left, const WMixinVector< ValueT > &right)
Wrapper around std::vector operator.
void insert(iterator where, InputIterator first, InputIterator last)
Wrapper around std::vector member function.
const_reference at(size_type index) const
Wrapper around std::vector member function.
void assign(size_type count, const value_type &value)
Wrapper around std::vector member function.
vector_type::const_iterator const_iterator
Compares to std::vector type.
WMixinVector & operator=(const WMixinVector &other)
Assigment operator for the WMixinVector itself.
const vector_type & asVector() const
Return this Mixin as its underlying real vector type.
reverse_iterator rbegin()
Wrapper around std::vector member function.
reference at(size_type index)
Wrapper around std::vector member function.
vector_type::reference reference
Compares to std::vector type.
void swap(WMixinVector &other)
Wrapper around std::vector member function.
vector_type::const_reference const_reference
Compares to std::vector type.
size_type capacity() const
Wrapper around std::vector member function.
void clear()
Wrapper around std::vector member function.
reference back()
Wrapper around std::vector member function.
void insert(iterator where, size_type count, const value_type &value)
Wrapper around std::vector member function.