mercredi 24 août 2016

How the new range-based for loop in C++17 helps Ranges TS?

The committee changed the range-based for loop from:

C++11
    {
       auto && __range = range_expression ; 
       for (auto __begin = begin_expr, __end = end_expr; 
           __begin != __end; ++__begin) { 
           range_declaration = *__begin; 
           loop_statement 
       }
    } 

to 
C++17    
    {        
        auto && __range = range_expression ; 
        auto __begin = begin_expr ;
        auto __end = end_expr ;
        for ( ; __begin != __end; ++__begin) { 
            range_declaration = *__begin; 
            loop_statement 
        } 
    }

And people said that this will make implementing Ranges TS easier. Can you give me some examples?

Aucun commentaire:

Enregistrer un commentaire