C++ Logo

std-proposals

Advanced search

Re: [std-proposals] pass() replacement for: forward<>()

From: Phil Bouchard <boost_at_[hidden]>
Date: Thu, 5 Jan 2023 22:53:09 -0500
On 1/5/23 22:23, Jason McKesson wrote:
>> So I can go ahead with a meta universal syntax because this is really what I am looking for.
> I have no idea why you're talking about a "meta universal syntax" when
> you know that nobody but yourself has any idea what you're talking
> about. Make up whatever terms you like, but it's not going to make
> your idea a good one.

Thanks for the long explanation but when I am referring to the meta
universal syntax, I am referring to a feature I will be adding to the
Fornux C++ Superset source-to-source compiler (if you wanna go into
details). That feature will convert:

#include <list>
#include <iostream>

using namespace std;


struct A
{
     virtual void foo(list<int> & l)
     {
         cout << __PRETTY_FUNCTION__ << endl;
     }
};

int main()
{
     list<int> l = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

     A a;

     a.foo(l);
     a.foo(list<int>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
}


Into:

#include <list>
#include <iostream>

using namespace std;


struct A
{
     virtual void foo(list<int> && l)
     {
         cout << __PRETTY_FUNCTION__ << endl;
     }
};

int main()
{
     list<int> l = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

     A a;

     a.foo(move(l));
     a.foo(move(list<int>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}));
}


Therefore mimicking non-const references to r-values. One complexity
step taken away!


Thanks,

-- 
Email Signature
Logo <https://www.fornux.com/>  
*Phil Bouchard*  facebook icon 
<https://www.linkedin.com/in/phil-bouchard-5723a910/>
CTO
T: (819) 328-4743
E: phil_at_[hidden]| www.fornux.com <http://www.fornux.com>
8 rue de la Baie| Gatineau (Qc), J8T 3H3 Canada
Banner <https://goglobalawards.org/> Le message ci-dessus, ainsi que les 
documents l'accompagnant, sont destinés uniquement aux personnes 
identifiées et peuvent contenir des informations privilégiées, 
confidentielles ou ne pouvant être divulguées. Si vous avez reçu ce 
message par erreur, veuillez le détruire.
This communication (and/or the attachments) is intended for named 
recipients only and may contain privileged or confidential information 
which is not to be disclosed. If you received this communication by 
mistake please destroy all copies.

Received on 2023-01-06 03:53:10