Welcome, Guest. Please login or register.

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


0 Members and 1 Guest are viewing this topic.

Offline SystemTopic starter

  • Full Member
  • ***
  • Join Date: Jul 2003
  • Posts: 199
    • Show only replies by System
    • http://amiga.org
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

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16866
  • Country: gb
  • Thanked: 4 times
    • Show only replies by 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