Giter Club home page Giter Club logo

Comments (6)

hernando avatar hernando commented on August 16, 2024

OK. I see that the semantics of release and operator[] guarantee that the data should not be deallocated while in use. Just a minor question then, does stde::hash_map guarantee that the iterators are not invalidated by insertions?

from collage.

eile avatar eile commented on August 16, 2024

Good question: I haven't paid attention. Can you look into it?

from collage.

hernando avatar hernando commented on August 16, 2024

The MSVC version doesn't invalidate them:

Each element contains a separate key and a mapped value. The sequence is represented in a way that permits lookup, insertion, and removal of an arbitrary element with a number of operations that is independent of the number of elements in the sequence (constant time) -- at least in the best of cases. Moreover, inserting an element invalidates no iterators, and removing an element invalidates only those iterators which point at the removed element.

SGI's documentation on std::hash_map says that resizing doesn't invalidate either:

[3] Resizing does not invalidate iterators; however, it does not necessarily preserve the ordering relation between iterators...

If gcc agrees with the original STL specification (not the C++ Standard Library), it should be save.

from collage.

eile avatar eile commented on August 16, 2024

Thanks. Iirc the gcc STL is the SGI/HP STL.

from collage.

eile avatar eile commented on August 16, 2024

Can be closed?

from collage.

hernando avatar hernando commented on August 16, 2024

I think so

from collage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.