A String of Wins

At this point, we have a fairly minimal string class. We can create a string, assign it a literal value in the form of a C string, and copy the value of one string to another; we can even pass a string as a value argument. Now we'll use the techniques that we've already covered (along with others that we find necessary in the process) to improve the facilities that the string class provides.

To make this goal more concrete, let's suppose that we want to modify the sorting program of Chapter 4 to sort strings, rather than shorts. To use the sorting algorithm from that program, we'll need to be able to compare two strings to see which would come after the other in the dictionary, as we can compare two shorts to see which is greater. ...

Get Learning to Program in C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.