4 ms·
Does your template work with memory managed by a GC and provide all the memory safety guarantees that .NET does? If so, does it work seamlessly across the stac
by nightski 8y ago
Does your template work with memory managed by a GC and provide all the memory safety guarantees that .NET does? If so, does it work seamlessly across the stack & the heap for both managed memory and unmanaged memory at the same time?
I get it, similar concepts - but let's not dismiss the value in this addition.
- c-smile 8y agoNo, this is pure C++ (non-managed) thing. It is used strictly in read-only places. It makes absolutely no sense to use things like std::string (and allocate it each time) when you need to pass string or fragment of string or array to consumers. For write-only access I also have target<T> that safely wraps all memcpy, memmove, strcpy[_s] cases.
- misnome 8y agoI didn’t read the poster as dismissing it (or claiming to have outright invented the concept) - rather pointing out that good implementations naturally keep re-arising.
- c-smile 8y agoYeah, this concept is quite old. It reincarnated quite many times: in D language by Walter Bright where arrays are just such slices. Or by Andrei Alexandrescu in its range<T> thing: http://www.informit.com/articles/article.aspx?p=1407357&seqNum=10 http://www.informit.com/articles/article.aspx?p=1407357&seqN...