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
Phil Bouchard facebook icon
CTO
T: (819) 328-4743
E: phil@fornux.com | www.fornux.com
8 rue de la Baie | Gatineau (Qc), J8T 3H3 Canada
Banner 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.