funções boost :: bind, std :: bind e sobrecarregadas
Notei que boost :: bind, ao contrário de std :: bind, pode funcionar com funções sobrecarregadas quando uma dessas funções não possui nenhum parâmetro. Estou certo? Isso está documentado?
#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
}