|
The Sparta Modeling Framework
|
An alternative to std::list, about 70% faster. More...
#include <FastList.hpp>
Classes | |
| class | NodeIterator |
| The internal iterator type of FastList. Use FastList<T>::[const_]iterator instead. More... | |
Public Types | |
| using | value_type = DataT |
| Handy using. | |
| using | iterator = NodeIterator<false> |
| Iterator type. | |
| using | const_iterator = NodeIterator<true> |
| Iterator type, const. | |
Public Member Functions | |
| FastList (size_t size) | |
| Construct FastList of a given size. | |
| ~FastList () | |
| Destroy (clear) the list. | |
| iterator | begin () |
| Obtain a beginning iterator. | |
| const_iterator | begin () const |
| Obtain a beginning const_iterator. | |
| iterator | end () |
| Obtain an end iterator. | |
| const_iterator | end () const |
| Obtain an end const_iterator. | |
| DataT & | front () |
| Get the front of the fast list non-const. | |
| const DataT & | front () const |
| Get the front of the fast list, const. | |
| bool | empty () const |
| size_t | size () const |
| size_t | max_size () const |
| void | clear () noexcept |
| iterator | erase (const const_iterator &entry) |
| Erase an element with the given iterator. | |
| template<class ... ArgsT> | |
| iterator | emplace (const const_iterator &pos, ArgsT &&...args) |
| template<class ... ArgsT> | |
| iterator | emplace_front (ArgsT &&...args) |
| Add an element to the front of the list. | |
| template<class ... ArgsT> | |
| iterator | emplace_back (ArgsT &&...args) |
| emplace an object at the back | |
| template<class ... ArgsT> | |
| iterator | insert (const const_iterator &pos, ArgsT &&...args) |
| void | pop_back () |
| Pop the last element off of the list. | |
| void | pop_front () |
| Pop the first element off of the list. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const FastList< DataT > &fl) |
An alternative to std::list, about 70% faster.
| T | The object to maintain |
This class is a container type that allows back emplacement and random deletion. 'std::list' provides the same type of functionality, but performs heap allocation of the internal nodes. Under the covers, this class does not perform new/delete of the Nodes, but reuses existing ones, performing an inplace-new of the user's object.
Testing shows this class is 70% faster than using std::list. Caveats:
Definition at line 47 of file FastList.hpp.
| using sparta::utils::FastList< DataT >::const_iterator = NodeIterator<true> |
Iterator type, const.
Definition at line 211 of file FastList.hpp.
| using sparta::utils::FastList< DataT >::iterator = NodeIterator<false> |
Iterator type.
Definition at line 210 of file FastList.hpp.
| using sparta::utils::FastList< DataT >::value_type = DataT |
Handy using.
Definition at line 87 of file FastList.hpp.
|
inline |
Construct FastList of a given size.
| size | Fixed size of the list |
Definition at line 191 of file FastList.hpp.

|
inline |
Destroy (clear) the list.
Definition at line 208 of file FastList.hpp.
|
inline |
Obtain a beginning iterator.
Definition at line 214 of file FastList.hpp.
|
inline |
Obtain a beginning const_iterator.
Definition at line 219 of file FastList.hpp.
|
inlinenoexcept |
Definition at line 246 of file FastList.hpp.
|
inline |
Definition at line 296 of file FastList.hpp.
|
inline |
emplace an object at the back
| args | The arguments to the T constructor |
Definition at line 373 of file FastList.hpp.
|
inline |
Add an element to the front of the list.
| args | Arguments to be passed to the user type for construction |
Definition at line 340 of file FastList.hpp.
|
inline |
Definition at line 236 of file FastList.hpp.
|
inline |
Obtain an end iterator.
Definition at line 224 of file FastList.hpp.
|
inline |
Obtain an end const_iterator.
Definition at line 227 of file FastList.hpp.
|
inline |
Erase an element with the given iterator.
| entry | Iterator to the entry being erased |
Definition at line 257 of file FastList.hpp.

|
inline |
Get the front of the fast list non-const.
Definition at line 230 of file FastList.hpp.

|
inline |
Get the front of the fast list, const.
Definition at line 233 of file FastList.hpp.

|
inline |
Insert an element at a specific place in the list. Really just an alias for emplace
Definition at line 402 of file FastList.hpp.
|
inline |
Definition at line 242 of file FastList.hpp.
|
inline |
Pop the last element off of the list.
Definition at line 407 of file FastList.hpp.

|
inline |
Pop the first element off of the list.
Definition at line 414 of file FastList.hpp.

|
inline |
Definition at line 239 of file FastList.hpp.
|
friend |
Definition at line 423 of file FastList.hpp.