Search code examples
c++gccstlunordered-set

unordered_set from std


I have to rewrite windows-code into crossplatform view. Here is the example:

std::unordered_set<Type>::iterator it = ...;
it._Ptr->_Myval->...

Everywere in code there is _Ptr member in iterator but I can't find it in docs. I think it works with visual studio (it's implementation of stl). Any ideas how to replace it? And what is _Myval?


UPD:

for(std::unordered_set<QuadTreeOccupant*>::iterator it = ...)
   it->aabb;

class QuadTreeOccupant
{
   public:
      AABB aabb;
};

And the error at line it->aabb:

error: request for member ‘aabb’ in ‘* it.std::__detail::_Hashtable_iterator<_Value, __constant_iterators, __cache>::operator-> with _Value = qdt::QuadTreeOccupant*, bool __constant_iterators = true, bool _cache = false, std::_detail::_Hashtable_iterator<_Value, __constant_iterators, __cache>::pointer = qdt::QuadTreeOccupant* const*’, which is of non-class type ‘qdt::QuadTreeOccupant* const’


Solution

  • Those are implementation details of unordered_map specific to VC's implementation. You should just remove the reference to _Ptr and _Myval and use either of:

    • it->
    • (*it).

    in place of it._Ptr->_Myval.