boost::bind, std::bind and overloaded functions

后端 未结 3 1834
遇见更好的自我
遇见更好的自我 2021-01-22 17:36

I noticed that boost::bind, unlike std::bind, can work with overloaded functions when one of these functions doesn\'t have any parameters. Am I right? Is this documented?

<
3条回答
  •  走了就别回头了
    2021-01-22 18:16

    The first case compiles well in MSVC10 with both std and boost (because MSVC10 doesn't support variadic templates, so std::bind is implemented similarly to boost::bind).

    The second case wouldn't compile, because bind can resolve overloads having different arity, but can't resolve overloads that differ by argument types only.

提交回复
热议问题