C++ Logo


Advanced search

Re: [std-proposals] Copy-construct, move-construct, and PR-construct

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Tue, 12 Sep 2023 06:11:47 +0200
So we would need new syntax, which creates exceptions to the conversion rules to make a workaround work in more cases by artificially widening, where and when elision is done and propagating the usage of this feature through function call hierarchies. Even if you have identified a missing piece, where C++ can be more complete, powerful and performant, the solution seems too complicated by a lot. For the same price (syntax, amount of rules, teaching) one can probably extend C++ with a broad feature that is less an exception to the rules, but now naturally expand on them and has broader usage.   -----Ursprüngliche Nachricht----- Von:Frederick Virchanza Gotham via Std-Proposals <std-proposals_at_[hidden]> Gesendet:Di 12.09.2023 01:36 Betreff:Re: [std-proposals] Copy-construct, move-construct, and PR-construct An:std-proposals_at_[hidden]; CC:Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>; On Sun, Sep 10, 2023 at 2:20 PM Frederick Virchanza Gotham wrote: > > If we were to instead mark the class, for example: So we already looked at two possibilities: (1) Mark the conversion operator (2) Mark the class The third possibility would be to have a base class that favours conversion:    class Monkey : public std::priority_conversion< std::mutex > {    public:        operator std::mutex(void)        {            // return a mutex from in here        }    }; And so when the compiler encounters the invocation of a constructor with just one argument, it checks to see if the argument is of a class type that inherits from "std::priority_conversion", and if it does, it invokes the conversion before passing the sole argument to the constructor. -- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2023-09-12 04:11:50