next up previous contents
Next: Flags in size_and_flags Up: Str Class Documentation Previous: Conclusion   Contents


Str Internals

After reading this chapter, you will be familiar with what a Str looks like in memory, what the time/space trade-offs are between Str and char*, and how Str supports features such as automatic memory management. If you are more interested in using Str than understanding how it works, (or if you find yourself getting bored) you can safely skip to chapter 4.

The first design challenge when creating Str was to create a memory structure that was space efficient but still met the goals of automatic memory management and efficient operations. Figure 3.1 shows the final design.

Figure 3.1: This figure shows the Str data structure in 3 different scenarios: an empty string, a basic string and a string with extra buffer available
\begin{figure}\begin{center}
\epsfig{file=Str_layout.eps, width=6in}\end{center}\end{figure}

Looking at figure 3.1:



Subsections
next up previous contents
Next: Flags in size_and_flags Up: Str Class Documentation Previous: Conclusion   Contents
2007-05-05