开发者

supporting for each loop in classes

开发者 https://www.devze.com 2023-01-05 06:58 出处:网络
how can i add \"for each\" 开发者_开发问答support for my class in c++0x and visual studio 2010?I think the best way would be to add iterator support, with begin() and end() functions. The ranged-based

how can i add "for each" 开发者_开发问答support for my class in c++0x and visual studio 2010?


I think the best way would be to add iterator support, with begin() and end() functions. The ranged-based for-loop uses them, and this also gives your class the richer set of functionality iterators provide.


You must make the class support the IEnumerable Interface

http://msdn.microsoft.com/en-us/library/system.collections.ienumerable.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消