unfortunatly this:
unordered_map<list<int>::iterator, int> foo;
does not work, compiler says: error c2338: c++ standard doesn't provide hash type.
there seems hash 64 bit integers though, save use
unordered_map<long long, int> foo;
instead , cast iterators long long
?
no, is, in general, not possible. while pointers can cast , integer types (more on later), iterators aren't pointers , cast isn't allowed. example, consider istream_iterator
, wraps stream object. it's unclear mean cast or long long
. if you're trying solve problem way, may need change approach.
as note - type long long
not required big enough hold pointer that's been converted integer. special types intptr_t
, uintptr_t
guaranteed big enough store pointer, might want start using types instead. still can't cast list iterators these types, though.
Comments
Post a Comment