save iterator as a DWORD

K

kubrinsky

Hi all !

I have a small trouble with iterators... Can you help me please.

The problem:

typedef std::map<int, int> M;
M m;
M::iterator i = m.begin();

DWORD d = (DWORD)i._Mynode();

M::iterator i2((M::_Imp::_Nodeptr)d); // <-- here i want to have an
iterator which point to same position as i

but _Nodeptr is protected type...

How to solve it ?

Alex
 
I

Ian Collins

Hi all !

I have a small trouble with iterators... Can you help me please.

The problem:

typedef std::map<int, int> M;
M m;
M::iterator i = m.begin();

DWORD d = (DWORD)i._Mynode();
Whatever a DWORD is, why would you want to use it to store an iterator?
A std::map::iterator is undoubtedly not a POD type.
 
G

Guest

Hi all !

I have a small trouble with iterators... Can you help me please.

The problem:

typedef std::map<int, int> M;
M m;
M::iterator i = m.begin();

DWORD d = (DWORD)i._Mynode();

M::iterator i2((M::_Imp::_Nodeptr)d); // <-- here i want to have an
iterator which point to same position as i

See those methods starting with an underscore("_") followed by a capital
letter, those are reserved for the implementation and not part of any
stable interface, which basically means that you should not use them
since they can change with the smallest update to your library.

Now, if you tell us the problem (which lead you to try this solution)
someone might be able to help you with a better solution.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top