GithubHelp home page GithubHelp logo

Comments (5)

JonathanDCohen avatar JonathanDCohen commented on July 3, 2024 1

I'll take a look at the aliasing issues.

For exception safety, the short story is that we know InlinedVector isn't exception safe. I'm currently writing tooling for us to thoroughly test our classes for exception safety. Once we have that, we will start updating all of our types which need to worry about exceptions accordingly.

I would guess that InlinedVector will have slightly weaker guarantees than std::vector, partly for the reasons you outlined. Our current thought is that we will be going for basic exception safety everywhere, and strong exception safety where reasonable and where it won't affect performance.

from abseil-cpp.

JonathanDCohen avatar JonathanDCohen commented on July 3, 2024 1

The two-iterator insert, we won't support aliasing, just like in std::vector (#4 in http://en.cppreference.com/w/cpp/container/vector/insert).

The iterator-count overload is also being fixed, yes :)

from abseil-cpp.

JonathanDCohen avatar JonathanDCohen commented on July 3, 2024

I took a look at this today. Insert() indeed has a bug, and it is fixed in an internal change which will be upstreamed once accepted. Similarly with operator=.

I don't see the issue with push_back. push_back calls emplace_back, which if we need to grow, calls GrowAndEmplaceBack. GrowAndEmplaceBack first allocates a new buffer, then constructs the new object into it, then moves everything else into the new buffer, so it should be safe.

from abseil-cpp.

stephan-tolksdorf avatar stephan-tolksdorf commented on July 3, 2024

You're right, I was mistaken about push_back, sorry.

The insert(const_iterator position, size_type n, const value_type& v) and insert(const_iterator position, InputIterator first, InputIterator last) (for forward iterators) overloads also suffer from this issue, but you've probably seen that too. Making the latter completely safe would hurt performance, but maybe an assert that checks e.g. the address of the first element in the range would be worth the overhead.

from abseil-cpp.

JonathanDCohen avatar JonathanDCohen commented on July 3, 2024

This is fixed in 5fcbe86

from abseil-cpp.

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.