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

Support for iterator constructors/deduction guides #61

Closed
Ryan-rsm-McKenzie opened this issue Sep 16, 2020 · 9 comments
Closed

Support for iterator constructors/deduction guides #61

Ryan-rsm-McKenzie opened this issue Sep 16, 2020 · 9 comments
Assignees

Comments

@Ryan-rsm-McKenzie
Copy link

Is any support for this planned? See here and here for reference.

@martinmoene
Copy link
Owner

@Ryan-rsm-McKenzie Thanks for your question/suggestion. I wasn't aware yet of these deduction guides. I'll take a look, will not be immediately though.

@martinmoene martinmoene self-assigned this Sep 17, 2020
@martinmoene
Copy link
Owner

martinmoene commented Sep 20, 2020

span iterator deduction guide:

template<class It, class EndOrSize>
span(It, EndOrSize) -> span<remove_reference_t<iter_reference_t<It>>>;

Constraints: It satisfies contiguous_­iterator.
std::iter_reference_t (C++20, p1037)
std::remove_reference_t (C++14/C++11)

@Ryan-rsm-McKenzie
Copy link
Author

The new deduction guides are failing to deduce reference types for iterators, presumably because of this line:

struct iter_reference { typedef T type; };

Here's a godbolt link.

@martinmoene
Copy link
Owner

Thanks @Ryan-rsm-McKenzie for your feedback. Currently my attention is a bit too scattered to do a good job in one go. A little back and forth may help :)

Having a look at it...

@martinmoene
Copy link
Owner

@Ryan-rsm-McKenzie I think this issue can be closed, otherwise please reopen it.

@Ryan-rsm-McKenzie
Copy link
Author

You're missing an iterator based constructor, so code like this won't compile.

@Ryan-rsm-McKenzie
Copy link
Author

I can't re-open the issue because you closed it

@martinmoene martinmoene reopened this Nov 19, 2020
martinmoene added a commit that referenced this issue Nov 24, 2020
Class template argument deduction (CTAD)

Affects:
- VS2019, MSVC++ 14.2  _MSC_VER >= 1920
- VS2017, MSVC++ 14.1, _MSC_VER >= 1910
@Ryan-rsm-McKenzie
Copy link
Author

this works

@martinmoene
Copy link
Owner

Thanks @Ryan-rsm-McKenzie !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants