#include #include #include /* Copyright 1999, Karl Nelson (contributions by eyal.ben-david@aks.com) This program shows how to use slots in STL maps to form callback maps for menus and such. */ #ifdef SIGC_CXX_NAMESPACES using namespace std; using namespace SigC; #endif typedef Slot1 MenuSlot; struct MenuItem { string name; int id; MenuSlot call; MenuItem(const char* s, int ID, MenuSlot acall) : name(s), id(ID), call(acall) {} MenuItem() : name(), id(0), call() {} }; int fred(int) {cout << "call fred"<>"; cin >> command; for (i=0;menu[i].id!=0;i++) if (menu[i].name==command) menu[i].call(i); } return 0; //compiling is passing }