On Saturday, May 12, 2012 13:10:17 Manu wrote: > That's not a solution, it's not even a work around, it's a totally > different operation. I may not want to, or can't, pass my data by value.
Whether passing by value makes sense depends on the struct. If it has lots of members, then no, passing by value doesn't work very well (though still not as badly as C++98 thanks to the fact that D can move structs far more often due to its different copy semantics). But almost all of the structs that I deal with only have a handful of member variables at most, so the cost of passing by value isn't high. In most cases, if I have a lot, I probably wanted a reference type anyway, in which case, I'm almost certainly going to use a class. But there's no question that the situation with const ref needs to be improved (it was discussed quite a bit on the beta list during the last beta). Fortunately, that's likely to happen sometime soon. - Jonathan M Davis