Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
2 つの関数オブジェクトが同じ関数参照を保持している場合、どうすれば比較できますか?
struct A { void b(){} } int main() { A a; auto f1 = std::bind(&A::b, a); auto f2 = std::bind(&A::b, a); f1 == f2 // ??? }
std::bindcallable であることと、 member type を持つことのみが保証された結果result_type。バインドされた関数を比較する標準準拠の方法はありません。
std::bind
result_type
戻り値 std::is_bind_expression::value == true であり、std::function に格納できる未指定の型 T の関数オブジェクト。f とすべての引数が移動可能な場合、オブジェクトは移動可能であり、それ以外の場合はコピー可能です。この型は、次のメンバーを定義します。
戻り値
std::is_bind_expression::value == true であり、std::function に格納できる未指定の型 T の関数オブジェクト。f とすべての引数が移動可能な場合、オブジェクトは移動可能であり、それ以外の場合はコピー可能です。この型は、次のメンバーを定義します。
http://en.cppreference.com/w/cpp/utility/functional/bindから