Suppose I have objects in range (r1,r2]
I want to insert as keys to a map. They have no iterator/next defined, but have a less than operator. How would I do this:
template< class K, class V>
void foo( K r1, K r2, V val ) {
for(K key = r1; key < r2; ++key )
{
mMap.insert(make_pair(key,val));
}
}
I cannot use ++key
.
K
could be any type which is copyable
, assignable
, has opertor<
but no equality operator
and arithmetic operators
.