forb
Public Types | Public Member Functions | List of all members
forbcc::ordered_unique_list< T > Class Template Reference

A template that can be used to declare a list of unique ordered items. More...

#include <ordered_unique_list.hpp>

Public Types

using set_t = std::map< std::string, int >
 The type of the set of keys, used to access the list.
 
using list_t = std::vector< T >
 The type of the list.
 
using const_T = typename std::add_const< T >::type
 Alias of the const version of the template type T.
 

Public Member Functions

virtual bool insert (std::string key, const T &value)
 Inserts a new value within the list if the corrisponding key is not present. More...
 
const list_tlist () const
 Returns a const reference to the list of the elements.
 
bool contains (std::string key) const
 Returns true if the given key is present within the set of keys.
 
T & operator[] (std::string key)
 Returns a reference to an element from its key. More...
 
const_Toperator[] (std::string key) const
 Same as operator[](std::string), but returns a const_T instead, when used on a const reference to the list object. More...
 

Detailed Description

template<typename T>
class forbcc::ordered_unique_list< T >

A template that can be used to declare a list of unique ordered items.

Member Function Documentation

§ insert()

template<typename T>
virtual bool forbcc::ordered_unique_list< T >::insert ( std::string  key,
const T &  value 
)
inlinevirtual

Inserts a new value within the list if the corrisponding key is not present.

Returns true on successful insertion.

Reimplemented in forbcc::method, and forbcc::type_struct.

§ operator[]() [1/2]

template<typename T>
T& forbcc::ordered_unique_list< T >::operator[] ( std::string  key)
inline

Returns a reference to an element from its key.

The key must be present, an exception may be thrown if that condition is not satisfied.

§ operator[]() [2/2]

template<typename T>
const_T& forbcc::ordered_unique_list< T >::operator[] ( std::string  key) const
inline

Same as operator[](std::string), but returns a const_T instead, when used on a const reference to the list object.


The documentation for this class was generated from the following file: