Re: What on earth is a ref function?

2010-08-09 Thread Simen kjaeraas
simendsjo simen.end...@pandavre.com wrote: The spec is very short here, and the example doesn't give me much.. // I thought allows functinos to return by reference meant it could return local variables.. ref int* ptr() { auto p = new int; *p = 12; return p; // Error:

What on earth is a ref function?

2010-08-08 Thread simendsjo
The spec is very short here, and the example doesn't give me much.. // I thought allows functinos to return by reference meant it could return local variables.. ref int* ptr() { auto p = new int; *p = 12; return p; // Error: escaping local variable } // So whats the

Re: What on earth is a ref function?

2010-08-08 Thread BCS
Hello simendsjo, The spec is very short here, and the example doesn't give me much.. // I thought allows functinos to return by reference meant it could return local variables.. ref int* ptr() { auto p = new int; *p = 12; return p; // Error: escaping local variable } // So whats the difference

Re: What on earth is a ref function?

2010-08-08 Thread Mike Parker
simendsjo wrote: The spec is very short here, and the example doesn't give me much.. // I thought allows functinos to return by reference meant it could return local variables.. ref int* ptr() { auto p = new int; *p = 12; return p; // Error: escaping local variable } For free