Tomas
Topic Author
Posts: 10
Joined: 29 Sep 2024, 18:27

Noesis 3.2.7 the Delegate operator += for lambdas is not compiled

22 Jan 2025, 21:02

Hi,
In any example, let in (Commands sample)
    MainWindow()
    {
        Initialized() += MakeDelegate(this, &MainWindow::OnInitialized);
        Initialized() += [](auto, const auto& e) { }; //C2679

        InitializeComponent();
    }
It doesn't work in Delegate.h
    /// Constructor from functor (lambda)
    template<class F, class = EnableIf<IsInvocable<decltype(&F::operator()), Ret, Args...>::Result>>  // !!!!!!!
    Delegate(const F& f);
 
User avatar
jsantos
Site Admin
Posts: 4823
Joined: 20 Jan 2012, 17:18
Contact:

Re: Noesis 3.2.7 the Delegate operator += for lambdas is not compiled

23 Jan 2025, 00:19

This is intentional. Versions prior to 3.2.7 were too permissive, allowing incorrect parameters and causing crashes or weird compiler errors.

Now, you must explicitly specify the parameters of the delegate::
class MainWindow final: public Window
{
public:
    MainWindow()
    {
        Initialized() += [](BaseComponent*, const EventArgs&)
        {
        };
    }
};

Who is online

Users browsing this forum: No registered users and 4 guests