i get the following output:
test_map.exe
a size: 2
i: 0 first 1 second test
i: 0 first 2 second test
i: 0 first 1852397404 second
... crash
can someone explain me that?
Your get_map function returns a copy of the internal map. So every time you're checking to see if it's time to finish ( it != a.get_map().end() ) you're using a whole new, completely different map object, so you're comparing iterators to different maps.
Don't return a copy of the map. Return a const ref to it, or some other such way of using the actual internal map, rather than a copy of it.
Obviously in a real class you wouldn't want to be just handing people direct access to internal variables, but for learning, this is all very educational.