map kinds of Ranges
Steven Schveighoffer
schveiguy at yahoo.com
Wed May 25 10:29:09 PDT 2011
On Wed, 25 May 2011 13:21:48 -0400, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> On 5/25/11 12:15 PM, Steven Schveighoffer wrote:
>> On Wed, 25 May 2011 12:19:03 -0400, Andrei Alexandrescu
>> <SeeWebsiteForEmail at erdani.org> wrote:
>>> The example should work. "auto ref" means "ref if possible, otherwise
>>> drop it".
>>
>> Wait, I thought auto ref was to allow rvalues to be passed by reference?
>> I.e. given the function:
>>
>> void foo(auto ref S s)
>>
>> then you could call foo with an rvalue or an lvalue for s.
>>
>> I swear every time you have an opinion on auto ref it changes :(
>>
>> Or are there two different meanings depending on whether auto ref is a
>> parameter or return value attribute?
>>
>> -Steve
>
> The same principle applies to your example: try ref if it works,
> otherwise drop it.
I have brought this up before, and you categorically denied it. If this
is the case, then auto ref must generate two different copies of the
function, one which takes ref and one which does not. You can't just
"drop ref" without having a separate function which is not ref (all
accesses to the parameter would be by value vs. by reference). I again am
confused about auto ref, and I thought I had figured it out :(
See this conversation:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=123664
-Steve
More information about the Digitalmars-d
mailing list