Amiga.org

Amiga News and Community Announcements => Amiga News and Community Announcements => Amiga Programming and Development => Topic started by: System on August 01, 2005, 03:21:02 AM

Title: Iterating Through Containers in C++, with Some Help from Boost's Lambda Library
Post by: System on August 01, 2005, 03:21:02 AM
Don't be jealous of programmers using new languages, such as Python or C#! C++ gives you many ways to iterate through data you've stored in containers, supports for-each, and has helpful devices called lambda functions. Jeff Cogswell shows you how you can fly through your containers with ease.

Link Here (http://www.informit.com/articles/article.asp?p=400651&rl=1)

Original source : Utilitybase.com
Title: Re: Iterating Through Containers in C++, with Some Help from
Post by: Karlos on November 29, 2005, 11:23:44 AM
Nice resource.

List iteration is just one of those things you can never avoid having to do in the real world. Luckily, amigaos linked lists are more than enough for amiga only coding in C.

The rest of the the time in C++ etc, in my experience you end up with containers full of pointers rather than containers full of actual objects. In C++ an ideal solution is to make base classes (or specialise an STL one) that handles void* in an optimal way and inherit it in a type safe template that adds no extra code. Less bloat, more performance, no sacrifice in compatibility (if using the STL interface anyway).