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

proposal: discuss internals regarding for loop #158

Open
ZenYuan opened this issue Dec 22, 2020 · 1 comment
Open

proposal: discuss internals regarding for loop #158

ZenYuan opened this issue Dec 22, 2020 · 1 comment

Comments

@ZenYuan
Copy link

ZenYuan commented Dec 22, 2020

Motivation

Please briefly describe your motivation.

Requirements

Please list all of your suggestions.


动机

区间for循环可以加上内部机制;读者可以更加灵活运用区间for循环

需求说明

比如for循环作用于自己定义的容器模板;该容器需要包含begin和end模板成员函数;
for(auto x : range_expression)内部机制:
{
init-statement
auto && __range = range_expression ;
auto __begin = begin_expr ;
auto __end = end_expr ;
for ( ; __begin != __end; ++__begin) {
range_declaration = *__begin;
loop_statement
}
}
引用:https://en.cppreference.com/w/cpp/language/range-for

@changkun
Copy link
Owner

PR welcome

@changkun changkun changed the title 第二章中区间for循环可以加上内部机制; proposal: discuss internals regarding for loop Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants