Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Placeholders namespace is ignored by Boost #18

Closed
mquevill opened this issue Sep 25, 2018 · 2 comments
Closed

Placeholders namespace is ignored by Boost #18

mquevill opened this issue Sep 25, 2018 · 2 comments

Comments

@mquevill
Copy link
Contributor

mquevill commented Sep 25, 2018

If you are trying to use mxx and Boost together, Boost will ignore the std::placeholders namespace in the below snippet of code.

            // create user function
            using namespace std::placeholders;
            m_user_func = std::bind(custom_op::custom_function<Func>,
                                  std::forward<Func>(func), _1, _2, _3, _4);

However, using the namespace explicitly resolves the conflict.

            // create user function
            m_user_func = std::bind(custom_op::custom_function<Func>,
                                    std::forward<Func>(func),
                                    std::placeholders::_1,
                                    std::placeholders::_2,
                                    std::placeholders::_3,
                                    std::placeholders::_4);

or, using an alias,

            // create user function
            namespace ph = std::placeholders;
            m_user_func = std::bind(custom_op::custom_function<Func>,
                                    std::forward<Func>(func),
                                    ph::_1, ph::_2, ph::_3, ph::_4);
@patflick
Copy link
Owner

Thank you @mquevill . I added the alias version to the code. This should fix the issue.

Cheers

  • Patrick

@patflick
Copy link
Owner

whoops. now using namespace instead of using for the namespace alias.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants