Skip to content

proposal: discuss internals regarding for loop #158

Open
@ZenYuan

Description

@ZenYuan

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions