DIP 1014

Walter Bright newshound2 at digitalmars.com
Tue Oct 2 09:17:39 UTC 2018


On 9/29/2018 9:34 PM, Manu wrote:
> Who knows about DIP 1014? (struct move hook)
> Is it well received? Is it likely to be accepted soon?
> 
> I'm working on the std::string binding, it's almost finished... but
> then I hit a brick wall.
> GNU's std::string implementation stores an interior pointer! >_<


The rationale behind D allowing structs to be moveable is to enable a copying 
garbage collector.

Some solutions to this problem:

1. Don't allow moving of C++ structs
2. Add a struct attribute that means "not moveable"
3. DIP 1014, which is add a __move_post_blit() function (most complex solution)
4. Use copy/destruct for C++ structs that have copy constructors (this is the 
old C++ solution, and is less efficient than the move constructor)

A discussion of the rationale for the C++ move constructor is:

https://akrzemi1.wordpress.com/2011/08/11/move-constructor/


 > Anyway, I'm blocked until this DIP is accepted; so, is it looking promising?

Pragmatically, I suggest for the moment just ignore the problem, file a bug 
report for std::string, and move on.


More information about the Digitalmars-d mailing list