Comments (6)
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.
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.
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>();
. Orvoid 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.
&& 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.
to ensure that the stream iterators and inserters [...] still meet their specifications
And specifications can change, BTW.
from cmcstl2.
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)
- view::join issue HOT 5
- Can __stl2::ref be a niebloid? HOT 1
- Infinite iota -> filter -> transform HOT 2
- value_type<T> does not return value type of a pointer HOT 2
- view::generate isn't pipeable HOT 3
- Help with adapting split_view to take a length rather than a pattern. HOT 3
- view::join functionality question
- Constraint recursion in any_iterator HOT 2
- max_element multiple occurrences returns last
- GCC 8.3 and 9.1: Internal compiler error in type_dependent_expression_p, at cp/pt.c:25930 HOT 3
- transform.hpp iter_move violates access control
- Concepts TS vs C++20 concepts HOT 1
- Drop range-and-a-half algorithm overloads HOT 1
- To __ugly or not to _Ugly HOT 1
- no match for call to size inside ref_view
- Add Windows Dockerfile for CI
- N1452 problems HOT 1
- Use iterator_concept rather than iterator_category
- temporary_vector.hpp: C++20 removed std::get_temporary_buffer
- views::{elements, values, keys} are missing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cmcstl2.