[Interest] QtCreator c++11 integration

Thiago Macieira thiago.macieira at intel.com
Tue Jun 11 01:48:51 CEST 2013

On segunda-feira, 10 de junho de 2013 23.47.04, André Pönitz wrote:
> > Same problem with with "auto"-typed variables. For example when
> > auto-typing a function: Auto class::dostuff() -> vector<int>*;
>    struct Foo { vector<int> *foo() { return new vector<int>(); } };
>    int main() { auto xp = Foo().foo(); xp->@
> also seems to work there.

That's not the feature he requested.

He's asking for this:

struct Foo {
    auto foo() -> vector<int> *
    { return new vector<int>(); }

    auto x = f.foo();

This corresponds to the qcompilerdetection.h macro Q_COMPILER_AUTO_FUNCTION.

Also note that C++14 will allow further reducing this to:
    auto foo()
    { return new vector<int>(); }

    auto x = f.foo();

I named that feature Q_COMPILER_AUTO_RETURN_TYPE in my branch, but I don't 
like the name. The committee is referring to this feature as "generalised 
lambda" (or something similar, I have to go find the expression) because it is 
similar to what you can do with a lambda:

    auto foo = []() { return new vector<int>(); }
    auto x = foo();

In other words, there are two features we're looking for here:
 1) supporting the new style function declaration from C++11
 2) inferring the type from a function body, as in:

    []() { return new vector<int>(); } ()->@

In all the cases above, @ should be showing the expansion of vector<int>.

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130610/fa62c58e/attachment.sig>

More information about the Interest mailing list