boost :: bind, std :: bind i przeciążone funkcje
Zauważyłem, że boost :: bind, w przeciwieństwie do std :: bind, może pracować z przeciążonymi funkcjami, gdy jedna z tych funkcji nie ma żadnych parametrów. Czy mam rację? Czy to jest udokumentowane?
#include <boost/bind.hpp>
#include <functional>
#include <iostream>
void foo()
{
std::cout << "::foo() \n";
}
void foo(int)
{
std::cout << "::foo(int) \n";
}
int main()
{
boost::bind(foo)(); // Ok
boost::bind(foo, 0)(); // Ok
// std::bind(foo)(); // Error
// std::bind(foo, 0)(); // Error
}
#include <boost/bind.hpp>
#include <functional>
#include <iostream>
void foo(int)
{
std::cout << "::foo(int) \n";
}
void foo(const std::string&)
{
std::cout << "::foo(const std::string&) \n";
}
int main()
{
// boost::bind(foo, 0)(); // Error
// boost::bind(foo, "str")(); // Error
// std::bind(foo, 0)(); // Error
// std::bind(foo, "str")(); // Error
}