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

prefer auto to Rng::(const_)?iterator for generic String #765

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

wanghan02
Copy link
Contributor

@wanghan02 wanghan02 commented Jul 20, 2023

  1. c++20 ranges library does not require a range to have member type/alias iterator/const_iterator.
  2. boost range library uses typename boost::range_iterator<Rng>::type instead of Rng::iterator because a customized Rng may not have member type/alias iterator/const_iterator. e.g. std::pair<It, It>.

Therefore for generic String type, auto is better than Rng::(const_)?iterator.

@wanghan02 wanghan02 force-pushed the thinkcell_prefer_auto_to_iterator branch from e9c7e0f to 4feef89 Compare July 20, 2023 10:50
@wanghan02 wanghan02 changed the title prefer auto to specific iterator type for generic String prefer auto/typename boost::range_iterator<Rng( const)?>::type to Rng::(const_)?iterator for generic String Jul 20, 2023
@wanghan02 wanghan02 force-pushed the thinkcell_prefer_auto_to_iterator branch from 4feef89 to 2389443 Compare July 20, 2023 11:16
@wanghan02 wanghan02 changed the title prefer auto/typename boost::range_iterator<Rng( const)?>::type to Rng::(const_)?iterator for generic String prefer auto to Rng::(const_)?iterator for generic String Jul 20, 2023
@wanghan02 wanghan02 force-pushed the thinkcell_prefer_auto_to_iterator branch from 2389443 to 0bd5492 Compare August 16, 2023 12:08
1. c++20 ranges library does not require a range to have member type/alias iterator/const_iterator.
2. boost range library uses typename boost::range_iterator<Rng>::type instead of Rng::iterator because a customized Rng may not have member type/alias iterator/const_iterator. e.g. std::pair<It, It>.
@wanghan02 wanghan02 force-pushed the thinkcell_prefer_auto_to_iterator branch from 0bd5492 to 1a09a54 Compare August 16, 2023 12:17
@wanghan02
Copy link
Contributor Author

The changes in this commit are all in x3 folder with std14 at least. Somehow CI fails in some std03/11 karma/qi builds.

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

Successfully merging this pull request may close these issues.

1 participant