Any plans to support STL value types?

Laeeth Isharc via Digitalmars-d digitalmars-d at puremagic.com
Fri May 15 12:57:13 PDT 2015


On Friday, 15 May 2015 at 19:44:29 UTC, Jonathan M Davis wrote:
> On Friday, 15 May 2015 at 18:42:31 UTC, Kagamin wrote:
>> Many STL types inherit from base classes, yet they are used as 
>> value types: std::string, std::vector etc. Are there plans to 
>> support C++ types with inheritance as proper value types in D 
>> frontend?
>
> Given that the inheritance they have is actually undesirable 
> when they are treated as value types, I doubt that there's much 
> need. If you're using inheritance in C++, you're putting your 
> class on the heap and accessing it via pointers, in which case, 
> accessing them in D as classes makes sense. And if you're using 
> these STL types as value types on the stack, then they can be 
> treated as value types. Doing otherwise just risks object 
> slicing, which is not desirable in the least.
>
> So, while I don't know how we're going to be handling STL types 
> (I don't even know what the current state of C++ state support 
> is, since it keeps improving), I really don't see why there's 
> value in supported inheritance with value types. It would just 
> be begging for bugs - which is why native D types don't support 
> it.
>
> - Jonathan M Davis

Is there any place better to go to learn about C++ support than 
the old dlang.org writeup?  My C++ knowledge isn't strong enough 
to just figure it out through experimentation, but there are some 
libraries I would like to link to.


More information about the Digitalmars-d mailing list