Skip to content

Compile error in projects using BOOST_BIND_NO_PLACEHOLDERS #426

@kzemek

Description

@kzemek

Our project is using BOOST_BIND_NO_PLACEHOLDERS because of frequent clashes with C++11 placeholders. When including cpp-netlib headers (boost/network/protocol/http/client.hpp), the project doesn't compile because the code expects placeholders to be accessible without qualifiers.

An example error looks as follows:

deps/cpp-netlib/cpp-netlibBuild-prefix/include/boost/network/protocol/http/policies/async_connection.hpp:83:39: error: ‘_4’ was not declared in this scope
                     this, _1, _2, _3, _4),
                                       ^

Because BOOST_BIND_NO_PLACEHOLDERS, boost::arg<N>(), boost::is_placeholder are undocumented (as per this thread on Boost mailing list) I'm not sure what would be the best way to solve the problem on cpp-netlib's side.

One workaround on our project's side is to pull std::placeholders into the global namespace before including cpp-netlib headers. (This works as long as you're not using any cpp-netlib functions.) Of course, one other approach would be to undefine BOOST_BIND_NO_PLACEHOLDERS and always qualify std::placeholders.

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