NAME

OTC_Single - Template class for encapsulating a single value.

SYNOPSIS


#include <OTC/collctn/single.hh>

template<class T>
class OTC_Single : public OTC_MPObject
{
  public:
    static os_typespec* get_os_typespec();
    inline OTC_Single(T const& theFirst);
    inline OTC_Single(OTC_Single<T> const& theSingle);
    inline OTC_Single<T>& operator=(OTC_Single<T> const& theSingle);
    inline T const& first() const;
    inline T& first();
};

CLASS TYPE

Concrete

DESCRIPTION

The OTC_Single class can be used to encapsulate a single item. This class is generally only useful where you want to ensure that an object is allocated from the common memory pool rather than the normal free store. Multi valued variants of this class are available in the form of the OTC_Pair and OTC_Triple classes.

INITIALISATION

inline OTC_Single(T const& theFirst);
inline OTC_Single(OTC_Single<T> const& theSingle);

ASSIGNMENT

inline OTC_Single<T>& operator=(OTC_Single<T> const& theSingle);

ACCESS

inline T const& first() const;
inline T& first();

NOTES

Naming of member functions is to be consistant with multi valued variants of this class.

SEE ALSO

OTC_Pair, OTC_Triple

LIBRARY

OTC

AUTHOR(S)

Graham Dumpleton

COPYRIGHT

Copyright 1993 TELSTRA CORPORATION LIMITED