c++0x nested binds?



  • Hallo

    sind nested binds in c++0x möglich?

    #include <utility>
    #include <functional>
    
    void dub(int)
    {
    }
    
    void dub2(std::function<void()>)
    {
    }
    
    template<class A> void dub3(A a)
    {
    	std::bind(dub2,std::move(a))();
    }
    
    int main()
    {
    	dub3(std::bind(dub,0));
    }
    

    gcc 4.4 mag diesen Code nicht, Fehler ist:

    test.cpp: In function 'void dub3(A) [with A = std::_Bind<void ((int))(int)>]':
    test.cpp:19: instantiated from here
    test.cpp:14: error: no match for call to '(std::_Bind<void (
    (std::_Bind<void (*(int))(int)>))(std::function<void()>)>) ()'
    Drücken Sie eine beliebige Taste . . .

    Wenn ich das Argument in dub3 explizit nach std::function caste funzt alles wunderbar.

    😕


Anmelden zum Antworten