Store values such that only one copy of the value is ever stored. More...
#include <unique_storage.h>

Classes | |
| struct | id_value |
| the actual ID type More... | |
Public Types | |
| typedef std::vector< V > | stored_values |
Public Member Functions | |
| unique_storage () | |
| virtual | ~unique_storage () |
| id_value const | create (V const &value) |
| ensure this value is available | |
| V const & | get (id_value const &id) const |
| return the stored value for the given ID | |
Store values such that only one copy of the value is ever stored.
I is an arbitrary typename that's never used.
It is a required parameter in order to enforce type-safety for a collection.
The value type "V" must be default-constructible, and this is the value returned by a stored id_value where .set() is false
| typedef std::vector<V> unique_storage< I, V >::stored_values |
| unique_storage< I, V >::unique_storage | ( | ) | [inline] |
| virtual unique_storage< I, V >::~unique_storage | ( | ) | [inline, virtual] |
| id_value const unique_storage< I, V >::create | ( | V const & | value | ) | [inline] |
ensure this value is available
| V const& unique_storage< I, V >::get | ( | id_value const & | id | ) | const [inline] |
return the stored value for the given ID
1.6.1