Bypassing the postblit?

Ritu ritu at metaprogramming.net
Sun Dec 29 08:22:01 PST 2013


> No. In D, struct are freely copied or moved depending on 
> whether the source is an lvalue or an rvalue. What is possible 
> is to define the post-blit function to work on the 
> already-blitted destination object.
>
> For example, if you don't want the source and the destination 
> share a member slice, the destination object's post-blit can 
> make a copy.

Ok, I will give you some background of what I am trying to do.

I have a struct that wraps a class object and lazily initializes 
it. Now in case the struct instance is passed as an argument to a 
function and it has not been initialized yet, the default copy 
constructor and the postblit do not offer a possibility to 
initialize the class object before copying.

Any possibility of *preblit* kind functionality?

Regards
- Ritu


More information about the Digitalmars-d mailing list