The c++ sequence-for based on sequence.begin()/end()/++,but the plain array such as int a[10]; can also perform this.Why?Is there some implicit cast from plain array to std::array?
            Asked
            
        
        
            Active
            
        
            Viewed 174 times
        
    0
            
            
         
    
    
        Shylock Hg
        
- 23
- 4
- 
                    2Duplicate of https://stackoverflow.com/q/7939399/3002139 – Baum mit Augen Sep 26 '18 at 09:57
1 Answers
1
            For plain arrays range-for uses special handling:
If
range_expressionis an expression of array type, thenbegin_expris__rangeandend_expris(__range + __bound), where__boundis the number of elements in the array (if the array has unknown size or is of an incomplete type, the program is ill-formed)
 
    
    
        Maxim Egorushkin
        
- 131,725
- 17
- 180
- 271