Possible issue found converting bind to lambda

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
FreddyFreddy
Posts: 176
Joined: Wed Mar 09, 2022 3:15 am
Location: Oz

Possible issue found converting bind to lambda

Post by FreddyFreddy »

Looking at Application.cpp clang-tidy.
This:

Code: Select all

_pActiveDoc->signalRecomputed.connect(std::bind(&App::Application::slotRecomputed, this, sp::_1));
is suggested to this:

Code: Select all

_pActiveDoc->signalRecomputed.connect([this](auto && PH1) {
        slotRecomputed(std::forward<decltype(PH1)>(PH1));
    });
but with an error:

Code: Select all

In template: no matching function for call to object of type '(lambda at /Users/bernie/CLionProjects/FreeCAD/src/App/Application.cpp:497:43)'
All the others in this section convert fine.
In Document.h:

Code: Select all

boost::signals2::signal<void (const App::Document&, const std::vector<App::DocumentObject*>&)> signalRecomputed;
The bind only passes one argument, when it appears two are expected?
I'm out of my depth here, but there is for sure an inconsistency.
Post Reply