Welcome, Guest. Please login or register.
Amiga Kit Amiga Store Hollywood MAL AMIStore App Store A600 Memory

AuthorTopic: Iterating Through Containers in C++, with Some Help from Boost's Lambda Library  (Read 2162 times)

0 Members and 1 Guest are viewing this topic.

Offline System

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

Original source : Utilitybase.com

Offline Karlos

Re: Iterating Through Containers in C++, with Some Help from
« Reply #1 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).
int p; // A