mapped_vector.h
Go to the documentation of this file.
//$$FILE$$
//$$VERSION$$
//$$DATE$$
//$$LICENSE$$
#ifndef MAPPED_VECTOR_H
#define MAPPED_VECTOR_H
#include <vector>
#include <map>
template <typename T, typename StringCompareT = std::less<T> >
class mapped_vector
{
private:
typedef std::map<T, unsigned int, StringCompareT> tIndex;
tIndex _index;
std::vector<T> _vector;
mutable std::pair<T, unsigned int> _current;
unsigned int get_index(const T& inT) const;
bool is_equal(const T& firstT, const T& secondT) const;
public:
mapped_vector();
mapped_vector(const StringCompareT& cmp);
mapped_vector(const mapped_vector& inMappedVector);
~mapped_vector();
void push_back(const T& inT);
unsigned int size() const;
bool empty() const;
void operator=(const mapped_vector& inMappedVector);
void operator=(const std::vector<T>& inVector);
bool operator==(const mapped_vector& inMappedVector);
bool operator!=(const mapped_vector& inMappedVector);
const T& operator[](unsigned int index) const;
const std::vector<T>& get_vector() const;
std::vector<T>& get_vector();
void erase(const T& inT);
void insert(const unsigned int index, const T& inT);
void index_it();
void clear();
unsigned int find(const T& inT) const;
};
#endif
mapped_vector::operator==
bool operator==(const mapped_vector &inMappedVector)
Definition: mapped_vector.C:122
mapped_vector::~mapped_vector
~mapped_vector()
Definition: mapped_vector.C:54
mapped_vector::insert
void insert(const unsigned int index, const T &inT)
Definition: mapped_vector.C:206
mapped_vector::clear
void clear()
Definition: mapped_vector.C:252
mapped_vector
Definition: mapped_vector.h:21
mapped_vector::get_vector
const std::vector< T > & get_vector() const
Definition: mapped_vector.C:156
mapped_vector::operator[]
const T & operator[](unsigned int index) const
Definition: mapped_vector.C:142
mapped_vector::find
unsigned int find(const T &inT) const
When not found, returns size()
Definition: mapped_vector.C:265
mapped_vector::size
unsigned int size() const
Definition: mapped_vector.C:79
mapped_vector::push_back
void push_back(const T &inT)
Definition: mapped_vector.C:63
mapped_vector::operator=
void operator=(const mapped_vector &inMappedVector)
Definition: mapped_vector.C:97
mapped_vector::erase
void erase(const T &inT)
Definition: mapped_vector.C:174
mapped_vector::index_it
void index_it()
Definition: mapped_vector.C:238
mapped_vector::empty
bool empty() const
Definition: mapped_vector.C:88
mapped_vector::operator!=
bool operator!=(const mapped_vector &inMappedVector)
Definition: mapped_vector.C:132
mapped_vector::mapped_vector
mapped_vector()
Definition: mapped_vector.C:22