[Cs3] Range based for loops with specified range
Mikhail Nesterenko
mikhail at cs.kent.edu
Wed Sep 24 21:29:10 EDT 2014
>
> I am emailing you so you can look into whether range based for loops can
> work within a specific range or if they have to work for the entire
> container they are being used on.
Well, no, no specific range. range-based-for loops work with raw
arrays, initializer lists
for(auto e : {1,2,3,4,5}) ....
and containers. Specifically, the container should provide begin() and
end() semantics. Here is a good detailed discussion
http://www.codesynthesis.com/~boris/blog/2012/05/16/cxx11-range-based-for-loop/
> Additionally you wanted to look into using function pointers for binding.
I was incorrect. bind() returns a functor (function object). A functor
does not have a specific memory address for its functions and cannot
be assigned to function pointer.
Thanks,
--
Mikhail
More information about the cs3
mailing list