Skip to content

How to capture by reference? #12

Open

Description

@denzor200

Is it possible with Boost Lambda 2? Is that truth that this library forces the users to capture by value?

Activity

  1. pdimov commented on Mar 16, 2025

    @pdimov
    Member

    std::ref should work. Is there a specific example where there's a problem?

  2. denzor200 commented on Mar 18, 2025

    @denzor200
    Author

    Is there a specific example where there's a problem?

    Nope, not a specific use case at all, moreover - I'm not going to capture by reference via this library in a real code :)

    The situation is that I am currently collecting ideas for improving the Clang Tidy static analysis tool.
    Recently I've submitted nice Feature Request(llvm/llvm-project#120863) to seek and hint UB that's created due to incorrect C++11 lambda usage.

    Then all I want to know is whether it is possible to reproduce the same UB by incorrectly using Boost Lambda 2 instead of C++11 lambda.

    std::ref should work.

    Hmmm, sounds interesting. I will try std::ref to reproduce that UB

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