Git Product home page Git Product logo

Comments (6)

CaseyCarter avatar CaseyCarter commented on June 16, 2024

This is going to need some care to ensure that the stream iterators and inserters (which are implemented with basic_iterator) still meet their specifications. I would be surprised if there is any test coverage.

from cmcstl2.

ericniebler avatar ericniebler commented on June 16, 2024

to ensure that the stream iterators and inserters [...] still meet their specifications

I don't think they can in general. How does istream_iterator<IAmNotMovable>::operator++(int) work?

EDIT: so maybe istream_iterator istream_iterator::operator++(int) requires Movable<T>();. Or void istream_iterator::operator++(int);

from cmcstl2.

CaseyCarter avatar CaseyCarter commented on June 16, 2024

I don't think they can in general.

Yes, I didn't mean generally so much as "for the cases that are not already broken." IIRC istreambuf_iterator uses the basic_iterator postincrement proxy support; it will be more broken if we simply yank things out.

EDIT: so maybe istream_iterator istream_iterator::operator++(int) requires Movable<T>();. Or void istream_iterator::operator++(int);

My istream_iterator currently requires:

DefaultConstructible<T>() // We can't "istream >> t;" without creating a T somehow
&& CopyConstructible<T>() // Copying iterators requires copying T
&& StreamExtractable<T, std::basic_istream<charT, traits>> // requires istream >> t

with assignment operations provided by destroy+construct if required in semiregular_box<T>. It would not be a huge leap to require Semiregular<T>().

from cmcstl2.

ericniebler avatar ericniebler commented on June 16, 2024

&& CopyConstructible<T>() // Copying iterators requires copying T

Technically, since this is an input iterator, you could hold a shared_ptr<T>. All copies can share the same T. The only place you need to copy is in op++(int), and I'm trying to kill that.

from cmcstl2.

ericniebler avatar ericniebler commented on June 16, 2024

to ensure that the stream iterators and inserters [...] still meet their specifications

And specifications can change, BTW.

from cmcstl2.

CaseyCarter avatar CaseyCarter commented on June 16, 2024

Technically, since this is an input iterator, you could hold a shared_ptr<T>

Yes, I know, but eww allocation.

And specifications can change, BTW.

I'm trying to eliminate undocumented discrepancies between cmcstl2 and D0459R1. If e.g. back_inserter doesn't meet the specification in D0459R1 because we gutted its post-increment operator, there must be a comment that summarizes the discrepancies and a link to the github issue discussing those discrepancies. Mentioning that here reminds me to evaluate the effect of the basic_iterator changes on the iterators when porting the change.

from cmcstl2.

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.