Skip to content

Bind can't use boost::result_of #30

Open

Description

@denzor200

I discovered that boost::bind strongly requires to have result_type meta-field from the type of the passed functional object. I was surprised, because why not to use boost::result_of when possible?
Can we fix it, even it will be a breaking change?

The shortest-reproducible example here:
https://godbolt.org/z/5fhb1hdYa

Activity

  1. pdimov commented on Nov 7, 2022

    @pdimov
    Member

    boost::bind predates result_of and was never updated to support it. As result_of is obsolete nowadays, if we're going to change boost::bind, we should make it use decltype directly.

    That's not an entirely trivial change though, because currently objects returned by boost::bind have a fixed return type, exposed via ::result_type.

  2. denzor200 commented on Nov 8, 2022

    @denzor200
    Author

    we should make it use decltype directly.

    You suggest to raise up minimal standard version to C++11 here? If so, what will be a reason to use boost::bind instead of std::bind? I thought this library is a C++03 analogue of C++11's std::bind

  3. denzor200 commented on Nov 8, 2022

    @denzor200
    Author

    Or you just want to say that boost::bind is obsolete and there is no sense to resolve this issue?

  4. pdimov commented on Nov 9, 2022

    @pdimov
    Member

    You suggest to raise up minimal standard version to C++11 here?

    On this specific instance I was thinking of using decltype when available, and retaining the current behavior when not.

    If so, what will be a reason to use boost::bind instead of std::bind? I thought this library is a C++03 analogue of C++11's std::bind

    boost::bind actually predates std::bind and is the source of the std::bind proposal. Much code still uses it so it would still make sense to keep it working even if we drop C++03, and it has some features that std::bind lacks, such as operators and some other subtle differences.

    Or you just want to say that boost::bind is obsolete and there is no sense to resolve this issue?

    boost::bind by itself may not be entirely obsolete, but I wouldn't invest much in new development targeting C++03.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions