boost::bind は、std::bind とは異なり、これらの関数のいずれかにパラメーターがない場合、オーバーロードされた関数で動作することに気付きました。私は正しいですか?これは文書化されていますか?
#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
}