RFC: naming for FrontTransversal and Transversal ranges
    Rainer Deyke 
    rainerd at eldwood.com
       
    Thu Apr 30 14:23:19 PDT 2009
    
    
  
Robert Jacques wrote:
> On Thu, 30 Apr 2009 14:40:42 -0400, Rainer Deyke <rainerd at eldwood.com>
> wrote:
>> In addition, there's this: suppose you have a struct containing a
>> (mutable) array.  When you make a copy of that struct, you will almost
>> always want to make a copy of the contained array.  Therefore value
>> semantics should be the default, because it simplifies the most common
>> use case.
> 
> That's what struct ctors/dtors/opAssign are for. Personally, I think
> letting the struct designer decide the behaviour is better.
I hope you're not suggesting writing ctor/dtor/opAssign for every single
struct that uses arrays as value types.
It's possible to write a reference wrapper around a value type.  It's
also possible to write a value wrapper around a reference type.
However, the former is both easier and more efficient than the latter.
-- 
Rainer Deyke - rainerd at eldwood.com
    
    
More information about the Digitalmars-d
mailing list