Optimized set with static allocation. More...
#include <StaticallyAllocatedSet.h>
Public Types | |
| typedef std::array< T, N >::iterator | iterator |
| typedef std::array< T, N >::const_iterator | const_iterator |
Public Member Functions | |
| StaticallyAllocatedSet () | |
| Create a set. More... | |
| std::size_t | size () const |
| Number of entries. More... | |
| bool | empty () const |
| Whether or not the set is empty. More... | |
| void | insert (const T &value) |
| Add a new entry to the set. More... | |
| void | clear () |
| Remove all entries. More... | |
| iterator | begin () |
| Iterator for the first entry. More... | |
| const_iterator | begin () const |
| Const iterator for the first entry. More... | |
| iterator | end () |
| Iterator for the last entry. More... | |
| const_iterator | end () const |
| Const iterator for the last entry. More... | |
| bool | contains (const T &value) const |
| Whether or not the set contains the given item. More... | |
| void | swap (StaticallyAllocatedSet< T, N > &other) |
| Swap the contents of this set with another. More... | |
| std::size_t | dataEndPos () const |
| Expert interface: the current ending position. More... | |
Private Attributes | |
| std::array< T, N > | _data |
| The data. More... | |
| std::size_t | _end_pos |
| Save the ending as positions internally. More... | |
Optimized set with static allocation.
Useful when you a set that is small and doesn't do any allocation. Small in this context is the size at which you are not concerned with the linear search that involves a comparison of T.
It is templated on the type the set will hold and the maximum size of the set (N)
Definition at line 29 of file StaticallyAllocatedSet.h.
| typedef std::array<T, N>::const_iterator MooseUtils::StaticallyAllocatedSet< T, N >::const_iterator |
Definition at line 33 of file StaticallyAllocatedSet.h.
| typedef std::array<T, N>::iterator MooseUtils::StaticallyAllocatedSet< T, N >::iterator |
Definition at line 32 of file StaticallyAllocatedSet.h.
|
inline |
Create a set.
Definition at line 38 of file StaticallyAllocatedSet.h.
|
inline |
Iterator for the first entry.
Definition at line 75 of file StaticallyAllocatedSet.h.
|
inline |
Const iterator for the first entry.
Definition at line 79 of file StaticallyAllocatedSet.h.
|
inline |
Remove all entries.
Note: this does NOT at all free any entries
Definition at line 70 of file StaticallyAllocatedSet.h.
|
inline |
Whether or not the set contains the given item.
Definition at line 93 of file StaticallyAllocatedSet.h.
Referenced by MooseUtils::StaticallyAllocatedSet< T, N >::insert().
|
inline |
Expert interface: the current ending position.
Definition at line 114 of file StaticallyAllocatedSet.h.
|
inline |
Whether or not the set is empty.
Definition at line 48 of file StaticallyAllocatedSet.h.
|
inline |
Iterator for the last entry.
Definition at line 84 of file StaticallyAllocatedSet.h.
|
inline |
Const iterator for the last entry.
Definition at line 88 of file StaticallyAllocatedSet.h.
|
inline |
Add a new entry to the set.
Definition at line 53 of file StaticallyAllocatedSet.h.
|
inline |
Number of entries.
Definition at line 43 of file StaticallyAllocatedSet.h.
|
inline |
Swap the contents of this set with another.
Definition at line 105 of file StaticallyAllocatedSet.h.
|
private |
The data.
Definition at line 118 of file StaticallyAllocatedSet.h.
Referenced by MooseUtils::StaticallyAllocatedSet< T, N >::begin(), MooseUtils::StaticallyAllocatedSet< T, N >::contains(), MooseUtils::StaticallyAllocatedSet< T, N >::end(), MooseUtils::StaticallyAllocatedSet< T, N >::insert(), and MooseUtils::StaticallyAllocatedSet< T, N >::swap().
|
private |
Save the ending as positions internally.
Definition at line 121 of file StaticallyAllocatedSet.h.
Referenced by MooseUtils::StaticallyAllocatedSet< T, N >::clear(), MooseUtils::StaticallyAllocatedSet< T, N >::contains(), MooseUtils::StaticallyAllocatedSet< T, N >::dataEndPos(), MooseUtils::StaticallyAllocatedSet< T, N >::empty(), MooseUtils::StaticallyAllocatedSet< T, N >::end(), MooseUtils::StaticallyAllocatedSet< T, N >::insert(), MooseUtils::StaticallyAllocatedSet< T, N >::size(), and MooseUtils::StaticallyAllocatedSet< T, N >::swap().
1.8.14