#include #include #include #include using namespace ::std; using namespace ::boost; class X { public: typedef vector StringList; // StringProcessingFunctor takes a single parameter of type // "const string&" and returns "void". template void enumerateStrings(StringProcessingFunctor functor) const { string s1("xyzzy1"); functor(s1); string s2("xyzzy2"); functor(s2); string s3("xyzzy3"); functor(s3); } private: }; int main() { X x; X::StringList strList; x.enumerateStrings(::boost::bind(&X::StringList::push_back, &strList, _1)); for (X::StringList::const_iterator it = strList.begin(); it != strList.end(); ++it) { cout << *it << endl; } return 0; }