c++ - What is "for (x : y)"? -
So I was looking at threads on the interwab and I came to discuss a blog / tutorial about threads, But I was confused for this line they have used
(Auto and Thread: thread) Actually it is not certain that this What does - there is a link to the blog here. I am talking about this - whoever answers this question for me You can also give me a reference so that I can read what he does and other related things that are blind to looking for me. C ++11 started a new trend statement, so called loop this is different from the general for loop, because it only gives you access to members of the category, without To give the name of the boundary and not the proxy iterator In particular, you do not want to change the category during the repetition, so this new loop documents the intent of "viewing each category element" and does nothing complicated with the range. The syntax is: For (declared X: R) {/ * body * /} , where declare is for some declaration and < Code> r is an arbitrary expression, it is functionally equivalent to the following traditional loop: {Auto & amp; Amp; __r = R; Using Std :: start; Using Std :: end; For (auto __it = start (__ r), __e = end (__ r); __it! = __e; ++ __ this) {decl x = * it; / * Body * /}} As a special case, arrays and braced lists are also basically supported.
Comments
Post a Comment