On 12/11/11 1:30 AM, Jonathan M Davis wrote:
On Sunday, December 11, 2011 01:16:28 Andrei Alexandrescu wrote:
To truly confer user-defined types the same capability, we should define
opPassByValue() which is implicitly invoked whenever an object is passed
by value into a function. By default that is a do-nothing operator; for
arrays it would do the cast thing (or, equivalently, invoke "[]" on the
array), and people could define it to do whatever. We could do all that.
The question is, is the added complexity justified?

I think that it's completely justified. We need a way to define tail-constness
for ranges. Given const's transitiveness, it's very easy to end up in a
situation where you have a const range, and having a means to get a tail-const
version of that range would be very valuable. I don't know if opPassByValue is
the best solution, but if not, we at least need a similar one.

I'm not sure. How many times have you been in a place in life where you had a const range on your hands, that's not an array? I haven't.

Andrei

Reply via email to