Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compat_ headers are an ODR nightmare #443

Open
danakj opened this issue Dec 20, 2023 · 1 comment
Open

compat_ headers are an ODR nightmare #443

danakj opened this issue Dec 20, 2023 · 1 comment
Labels
design Design of the library systems as a whole, such as concepts
Milestone

Comments

@danakj
Copy link
Collaborator

danakj commented Dec 20, 2023

Collapse these headers or include them from the concept-defining location?

But we don't want to include every container header from the from_iterator.h header. However it's real bad if some places see FromIteratorstd::vector to be true and others see it to be false. The compiler can cache the answer and get false everywhere unexpectedly.

The right thing to do is to ensure the concept knows the right answer where the concept is defined, or where the std::vector (etc) type is defined. We can't do the latter so... how do we do the former?

Or, once sus::Vec is backed by std::vector do we just say you'd it.collect<sus::Vec<T>>() and then you can convert for ~free to std::vector? That feels bad though. It would be better to it.collect<std::vector<T>>().

Notably we avoided this issue for option/result and numerics, so this does not block the numerics milestone.

@danakj danakj added the design Design of the library systems as a whole, such as concepts label Dec 20, 2023
@danakj danakj added this to the 1. Iterators milestone Dec 20, 2023
@danakj
Copy link
Collaborator Author

danakj commented Dec 21, 2023

My brain came up with an answer here this morning.

define concepts that match the shape of std containers, like a ReservePushBackContainer for vector. Then provide from_iter impls for those concepts beside the FromIterator concept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Design of the library systems as a whole, such as concepts
Projects
None yet
Development

No branches or pull requests

1 participant