curimit / SugarCpp

SugarCpp is a language which can compile to C++11.
135 stars 13 forks source link

Use the portable C++11 lambdas instead of G++ "compound expressions" extension in List Generation and Where Expression #46

Open munael opened 9 years ago

munael commented 9 years ago

Basically, replace:

auto c = ({
        forward_list<int> _t_return_value;
        for (auto i = 1; i <= 10; ++i) {
            _t_return_value.push_front(i);
        }
        _t_return_value;
    });

, for example, with:

auto c = [](){
    forward_list<int> _t_return_value;
    for (auto i = 1; i <= 10; ++i) {
            _t_return_value.push_front(i);
        }
    return _t_return_value;
} ();

instead. For portability.

Awesome work :)