Template Class LinearSet

Class Documentation

template<typename T>
class LinearSet

A sorted container of unique elements with contiguous storage.

Param <T>

The type of eleemnts to store

Public Functions

LinearSet() = default

Constructs an instance of LinearSet<>

inline std::vector<T>::const_iterator begin() const

Gets an iterator to this LinearSet<>'s first element.

Returns

An iterator to this LinearSet<>'s first element

inline std::vector<T>::const_iterator end() const

Gets an iterator to this LinearSet<>'s last element.

Returns

An iterator to this LinearSet<>'s last element

inline bool empty() const

Gets a value indicating whether or not this LinearSet<> is empty.

Returns

Whether or not this LinearSet<> is empty

inline size_t size() const

Gets the number of elements in this LinearSet<>

Returns

The number of elements in this LinearSet<>

inline void clear()

Clears all elements from this LinearSet<>

inline std::pair<typename std::vector<T>::const_iterator, bool> insert(T const &element)

Inserts an element into this LinearSet<> if the element is not already present.

Parameters

element -- [in] The element to insert

Returns

An std::pair<> consisting of an iterator to the inserted element and a value indicating whether or not an insertion occured

inline std::vector<T>::const_iterator find(T const &element) const

Finds the given element if it is present in this LinearSet<>

Parameters

element -- [in] The element to find

Returns

An iterator to the element or end() if the element isn't found

inline T const *data() const

Gets a pointer to this LinearSet<>'s underlying storage.

Returns

A pointer to this LinearSet<>'s underlying storage