www.digitalmars.com         C & C++   DMDScript  

c++.stlsoft - string_view

reply "Matthew" <matthew hat.stlsoft.dot.org> writes:
I just had a reader (who's also a friend) email me with a +ve response
regarding my article on String Views in Jan's CUJ: "A View To A String, part
1" (http://www.cuj.com/documents/s=8188/cuj0601wilson/0601wilson.html)

As many of you know, CUJ has ceased publication, so the follow up
instalments won't be available in CUJ. However, I'm planning on including
them in my online column (http://www.ddj.com/columns/wilson/) over the next
few months.

I'm intending to cover applications to which string views have been put - my
friend uses them in a compiler implementation - and also quantifying the
performance benefits.

I'll be more than happy to credit anyone who wants to volunteer any such


Jan 13 2006
parent Sean Kelly <sean f4.ca> writes:
That would be me.  As the compiler deals strictly with memory-mapped 
files, it seemed silly to work with copies of the string data when it 
could be referenced directly.  And having interface compatibility with 
standard sequence containers makes swapping between a string and view 
representation require little more than changing a typedef.  The view 
implementation I'm currently using is one I created for use with this 
compiler, but having now read Matthew's article I'm going to take his 
somewhat more robust version for a spin.  Either way, I think the view 
approach is a clear win over std::string, both in memory use and in 
overall performance.

Jan 14 2006