beautypg.com

Tools.h++ templates and the standard c++ library, Standard c++ library not required, Standard c – HP Integrity NonStop J-Series User Manual

Page 116: Library not required

background image

Click on the banner to return to the user guide home page.

©Copyright 1996 Rogue Wave Software

Tools.h++ Templates and the Standard C++
Library

Most of the Tools.h++ collection class templates use the Standard C++ Library for their
underlying implementation. The collection classes of the Standard C++ Library, called
containers, act as an engine under the hood of the Tools.h++ templates.

For example, the value-based Tools.h++ double-ended queue

RWTValDeque

has-a

member of type deque from the Standard C++ Library. This member serves as the
implementation of the collection. Like an engine, it does the bulk of the work of adding and
removing elements, and so on.

RWTValDeque

is a wrapper class, like the hood protecting

the engine. More than cosmetic, it functions as a simpler, object-oriented interface to the

deque

class, making it easier and more pleasant to deal with.

Thanks to inlining and the lack of any extra level of indirection, this wrapping incurs few, if
any, performance penalties. If you need direct access to the implementation, the wrapper classes
offer the member function std(), which returns a reference to the implementation. In addition,
because the Rogue Wave template collections supply standard iterators, you can use them with
the Standard C++ Library algorithms as if they were Standard C++ Library collections
themselves.

Standard C++ Library Not Required

A unique feature of this version of Tools.h++ is that many of its template collections do not
actually require the presence of the Standard C++ Library. Consider

RWTValDlist

. If you

are using Tools.h++ on a platform that supports the Standard C++ Library, RWTValDlist
will be built around the Standard C++ Library list container. But if your platform does not
support the Standard C++ Library, you may still use the class. Tools.h++ accomplishes this feat
transparently through an alternate implementation, not based on the Standard C++ Library. The
appropriate implementation is selected at compile time based on the settings in the
configuration header file, rw/compiler.h. In fact, the alternate implementations are exactly those
that were employed in the previous version of Tools.h++.

When using one of these template collections without the Standard C++ Library, you will be
restricted to a subset of the full interface. For example, the std() member function mentioned
above is not available, nor are the begin() and end() functions, which return Standard C++

This manual is related to the following products: