Autocomplete — C++14 auto for lambda arguments

Sysprogs forums Forums VisualGDB Autocomplete — C++14 auto for lambda arguments

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #26216
    Ophidian14
    Participant

    Consider:

    #include <algorithm>
    #include <vector>
    struct Foo
    {
      int Integer;
    };
    std::vector<Foo> v;
    bool b = std::any_of(v.begin(), v.end(), (const auto& f) { return 6 == f.Integer; });
    

    With the lambda argument as type “auto” I don’t get auto-complete when I type “f.” in the lambda.  With “Foo” instead of auto, I do.

    • This topic was modified 5 years, 2 months ago by Ophidian14.
    #26218
    support
    Keymaster

    Sorry,  this is a limitation of the way Clang performs C++ parsing. At the time the lambda body is parsed, the template argument deduction for any_of() hasn’t happened yet, so “f” is not yet resolved. Specifying it explicitly indeed provides enough information for auto-completion.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.