Sorry, if this is off topic. I have an application where I want to call a group of functions, in turn.
My initial thought was to use function pointers and a list. If the function is defined outside the class, I can add it to the list. f1 in the example. If the function is declared in the class, I get a compile error, f2 in the example. I have tried qualifying f2, etc. No luck.
I think this is because of my lack of understanding... I compile with g++ -c -I. mylist.cc -o mylist.o What is the proper syntax? Tom Dean > cat mylist.h #include <iostream> #include <list> #include <algorithm> using namespace std; class MyList { private: list<bool (*)(void)> list1; bool f2(void); public: MyList(); void do_list(); }; > cat mylist.cc #include <iostream> #include <list> #include <algorithm> #include <mylist.h> using namespace std; bool f1(void) { cout << "f1" << endl; return true; } bool MyList::f2(void) { cout << "f2" << endl; return true; } MyList::MyList() { list1.push_back(f1); list1.push_back(f2); } _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-gcc-list