Similar to std::unordered_map, but it will manage reference count automatically internally.
More...
|
iterator | begin () |
| Return iterator to beginning. More...
|
|
const_iterator | begin () const |
| Return const_iterator to beginning. More...
|
|
iterator | end () |
| Return iterator to end. More...
|
|
const_iterator | end () const |
| Return const_iterator to end. More...
|
|
const_iterator | cbegin () const |
| Return const_iterator to beginning. More...
|
|
const_iterator | cend () const |
| Return const_iterator to end. More...
|
|
| Map () |
| Default constructor.
|
|
| Map (ssize_t capacity) |
| Constructor with capacity. More...
|
|
| Map (const Map< K, V > &other) |
| Copy constructor. More...
|
|
| Map (Map< K, V > &&other) |
| Move constructor. More...
|
|
| ~Map () |
| Destructor. More...
|
|
void | reserve (ssize_t capacity) |
| Sets capacity of the map. More...
|
|
ssize_t | bucketCount () const |
| Returns the number of buckets in the Map container. More...
|
|
ssize_t | bucketSize (ssize_t n) const |
| Returns the number of elements in bucket n. More...
|
|
ssize_t | bucket (const K &k) const |
| Returns the bucket number where the element with key k is located. More...
|
|
ssize_t | size () const |
| The number of elements in the map. More...
|
|
bool | empty () const |
| Returns a bool value indicating whether the map container is empty, i.e. More...
|
|
std::vector< K > | keys () const |
| Returns all keys in the map. More...
|
|
std::vector< K > | keys (V object) const |
| Returns all keys that matches the object. More...
|
|
const V | at (const K &key) const |
| Returns a reference to the mapped value of the element with key k in the map. More...
|
|
const_iterator | find (const K &key) const |
| Searches the container for an element with 'key' as key and returns an iterator to it if found, otherwise it returns an iterator to Map<K, V>::end (the element past the end of the container). More...
|
|
void | insert (const K &key, V object) |
| Inserts new elements in the map. More...
|
|
iterator | erase (const_iterator position) |
| Removes an element with an iterator from the Map<K, V> container. More...
|
|
size_t | erase (const K &k) |
| Removes an element with an iterator from the Map<K, V> container. More...
|
|
void | erase (const std::vector< K > &keys) |
| Removes some elements with a vector which contains keys in the map. More...
|
|
void | clear () |
| All the elements in the Map<K,V> container are dropped: their reference count will be decreased, and they are removed from the container, leaving it with a size of 0.
|
|
V | getRandomObject () const |
| Gets a random object in the map. More...
|
|
Map< K, V > & | operator= (const Map< K, V > &other) |
| Copy assignment operator. More...
|
|
Map< K, V > & | operator= (Map< K, V > &&other) |
| Move assignment operator. More...
|
|
template<class K, class V>
class cocos2d::Map< K, V >
Similar to std::unordered_map, but it will manage reference count automatically internally.
Which means it will invoke Ref::retain() when adding an element, and invoke Ref::release() when removing an element.
- Warning
- The element should be
Ref
or its sub-class.