TITLE: stl, stacks, and changing standards (Newsgroups: comp.lang.c++.moderated, 13 May 97) MOORE: "John I. Moore, Jr." <70672.1744@compuserve.com> First, here are several good books about STL. [Glass 1996] Graham Glass and Brett Schuchert, The STL , Prentice-Hall, 1996. [Musser 1996] David R. Musser and Atul Saini, STL Tutorial and Reference Guide: C++ Programming with the Standard Template Library, Addison-Wesley, 1996. [Nelson 1995] Mark Nelson, C++Programmer's Guide to the Standard Template Library, IDG Books, 1995. I would personally recommend [Musser] and [Nelson], but you should realize that there have been some changes to the C++ standard and STL since these books were published. Look for new editions of these books in the next year or so. Second, there are trees in STL, but they are not obvious. The set class is implemented as a tree. See if you can use the set class for your work. Third, your problem with stacks is a basic lack of understanding of how stacks work in STL. Essentially, stacks are not stand-alone classes but are implemented as adaptors using one of the other container classes. For example, stack s; is invalid, but stack< vector > s; // space required between two trailing ">" is valid. (Some implementations may require explicit mention of the allocator in order to make this valid, but this is simply a temporary deficiency in the compiler and should be corrected as the compiler vendor moves toward standardization. KUEHL: kuehl@uzwil.informatik.uni-konstanz.de (Dietmar Kuehl) [ (Former) stack s; (Latter) stack< vector > s; -adc ] Note, that the latter is invalid under the definitions of the forthcoming standard while the former is valid under these definitions! Currently, the situation is reversed for some implementations... The reason is a change of the adaptor classes. While eg. 'stack' is currently defined as template class stack {...}; it will become template > class stack {...}; in a conforming implementation (see 23.2.3.3, lib.stack, of the Nov 96 DWP for a reference).