// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
#include <iostream>
#include <list>
#include <string>

using namespace std;

struct Foobar
{
    int a;
    string b;
    Foobar(const int a, const string b) { this->a = a; this->b = b; }
    bool operator==(const Foobar &o) { return a==o.a; }
};

int main()
{
    list<Foobar> lst;
    Foobar x(1, "A");
    lst.push_back(x);
    Foobar y(2, "BB");
    lst.push_back(y);
    Foobar z(3, "CCC");
    lst.push_back(z);
    for (list<Foobar>::iterator it = lst.begin(); it != lst.end(); ++it)
    {
        cout << it->a << " " << it->b << endl;
    }
    lst.remove(y);
    for (list<Foobar>::iterator it = lst.begin(); it != lst.end(); ++it)
    {
        cout << it->a << " " << it->b << endl;
    }
    return 0;
}
