Код: Выделить всё
/*
* Conversion operator: converts any iterator (iterator or const_iterator) to a const_iterator.
*
* Usage:
* iterator iter = map.begin();
* const_iterator c_iter = iter; // implicit conversion
*
* Implicit conversion operators are usually frowned upon, because they can cause
* some unexpected behavior. This is a rare case where a conversion operator is
* very convenient. Many of the iterator functions in the HashMap class are
* secretly using this conversion.
*
* Note: conversion in the opposite direction (const to non-const) is not safe
* because that gives the client write access the map itself is const.
*/
operator HashMapIterator() const {
return HashMapIterator(_buckets_array, _node, _bucket);
}
Подробнее здесь: https://stackoverflow.com/questions/786 ... de-working