chromium / subspace

A concept-centered standard library for C++20, enabling safer and more reliable products and a more modern feel for C++ code.; Also home of Subdoc the code-documentation generator.
https://suslib.cc
Apache License 2.0
89 stars 15 forks source link

Iterator::collect should ideally support conversions #425 #451

Closed Ananyasingh2002 closed 5 months ago

Ananyasingh2002 commented 9 months ago

Resolved the issue#425 with collecting Iterator<const std::string&> into Vec. Implemented map(|s| s.to_owned()) to convert constant references in the iterator to owned std::strings. This transformation rectified the mismatch, allowing successful collection into Vec. The adjustment eliminates the need for .cloned() and ensures compatibility with the copy constructible type.

google-cla[bot] commented 9 months ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Neilblaze commented 9 months ago

@Ananyasingh2002 you need to sign the CLA first to make the workflow run.

Ananyasingh2002 commented 9 months ago

Hello @Neilblaze, It seems there's an issue preventing me from signing the Contributor License Agreement (CLA). The message indicates a server error, advising me to retry the request.

danakj commented 9 months ago

I am a bit confused about this PR. It seems to be assuming the collect function is doing conversion already?

The issue is that IntoIterator (and thus collect) requires the into_iter() function's returned Iterator::Item type to be exactly the same as the type specified in IntoIterator. But I believe it would be better here to match an Iterator::Item type if its convertible-to the type in IntoIterator.

Some options:

I will copy these thoughts to the issue.

danakj commented 8 months ago

Haven't heard anything in a bit here, will you be coming back to it?