DMD OSX / Segfault 11
    Robert M. Münch via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Wed Feb  3 05:16:27 PST 2016
    
    
  
On 2016-02-02 19:03:04 +0000, anonymous said:
> This isn't valid D code at all, which makes it unnecessarily hard to 
> understand what you mean.
Well, it should of course be:
BaseOperator: Value {
}
> A Value* is a pointer to a class reference. Unless you're doing 
> something really funky with the pointer, casting it to a class type 
> doesn't make sense.
> 
> Casting between class types that have an inheritance relation, like 
> Value and BaseOperator, does make sense (upcat/downcast).
Yes, that's what I need.
> If anything, you should be casting between Value* and BaseOperator* 
> (both pointer types) if you want to do something with pointers.
I tried this, but that doesn't work either.
> But you very seldom need pointers to class references. Just return 
> Value from get, and cast to BaseOperator.
But am I not getting a copy then? I want to avoid copying objects as 
much as possible.
-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
    
    
More information about the Digitalmars-d-learn
mailing list