A {
                  
                  
                      void Baa(int) {};
                  
                  
                  }
                  
                  
                  
                  
                  
                  A a;
                  
                  
                  
                  
                  
                  struct U {
                  
                  
                      void Buu() {
                  
                  
                          boost::bind(&A::Baa, &a, _1);
                  
                  
                      }
                  
                  
                  }
                  
                  
                  
                  
                  
                  Not works:
                  
                  
                  struct A {
                  
                  
                      void Baa(int) {};
                  
                  
                  };
                  
                  
                  
                  
                  
                  struct U {
                  
                  
                      void Buu() {
                  
                  
                          boost::bind(&A::Baa, &a, _1);
                  
                  
                      }
                  
                  
                      A a;
                  
                  
                  };
                  
                  
                
https://gcc.godbolt.org/z/D2KJdf
if boost::bind works the same way as std::bind, you are supposed to store the resulting callable object somewhere and call it later. :/ otherwise the expression inside Buu() has no effect, and the struct is empty.
Обсуждают сегодня