// Test.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung. // #include "stdafx.h" #include #include #include #include // struct Teststruct { void foo() { std::cout << "foohooo" << std::endl; } }; // void funcFoo() { std::cout << "Func foohooo" << std::endl; } // class CCycleThread : boost::noncopyable { public: /******************************************************************************/ /* constructor */ /******************************************************************************/ template CCycleThread(T t) { m_thread.reset(new boost::thread(boost::bind(&CCycleThread::execute,this,t))); } private: /******************************************************************************/ /* thread method */ /******************************************************************************/ template void execute(T t) { for(;;) t(); } // std::unique_ptr m_thread; }; // int main() { Teststruct testObj; // CCycleThread cycleThread(funcFoo); //compiles CCycleThread anotherCycleThread(boost::bind(&Teststruct::foo,&testObj)); //compiles not _getch(); return 0; }