The problem that took him 5 years to fix in C++, I solved in a minute with D

Steven Schveighoffer schveiguy at gmail.com
Thu Mar 10 20:44:11 UTC 2022


On 3/10/22 3:31 PM, IGotD- wrote:
> On Thursday, 10 March 2022 at 02:01:01 UTC, matheus wrote:
>> Hi,
>>
>> Today someone sent me this video: 
>> https://www.youtube.com/embed/ABg4_EV5L3w
>>
>> [...]
>>
> 
> Another thing that kept agonizing me during this video is how the author 
> use and mixed std::string and std::string_view. Having two containers 
> doing functionally the same thing is insane.
> 
> 

It's because std::string_view doesn't manage its memory. If std::string 
worked at compile time, he would have just done that.

std::string_view is the equivalent of D's string, it has a pointer and 
length. std::string is the equivalent of the nefarious GC array 
management mechanism that has no type or name, but works great at both 
runtime and compile time.

-Steve


More information about the Digitalmars-d mailing list