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

Paulo Pinto pjmlp at progtools.org
Thu Mar 10 20:43:53 UTC 2022


On Thursday, 10 March 2022 at 20:31:55 UTC, 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.

They aren't the same thing, std::string_view is a string slice 
that doesn't own the pointed data, while string owns the data and 
is responsible for its deallocation, their memory usage is 
definitely not the same and matter a lot in a language with 
manual memory management.


More information about the Digitalmars-d mailing list