Mercurial > illumos > onarm
view usr/src/cmd/man/src/util/nsgmls.src/include/List.h @ 0:c9caec207d52 b86
Initial porting based on b86
author | Koji Uno <koji.uno@sun.com> |
---|---|
date | Tue, 02 Jun 2009 18:56:50 +0900 |
parents | |
children | 1a15d5aaf794 |
line wrap: on
line source
// Copyright (c) 1994 James Clark // See the file COPYING for copying permission. #pragma ident "@(#)List.h 1.4 00/07/17 SMI" #ifndef List_INCLUDED #define List_INCLUDED 1 #include "IList.h" #include "Link.h" #ifdef SP_NAMESPACE namespace SP_NAMESPACE { #endif template<class T> class ListItem : public Link { public: ListItem(const T &v) : value(v) { } T value; }; template<class T> class ListIter; template<class T> class List { public: List() { } void append(const T &item) { list_.append(new ListItem<T>(item)); } void insert(const T &item) { list_.insert(new ListItem<T>(item)); } const T &head() const { return list_.head()->value; } void remove(const T &); T get(); int empty() const { return list_.empty(); } friend class ListIter<T>; private: List(const List<T> &); // undefined void operator=(const List<T> &); // undefined IList<ListItem<T> > list_; }; #ifdef SP_NAMESPACE } #endif #endif /* not List_INCLUDED */ #ifdef SP_DEFINE_TEMPLATES #include "List.cxx" #endif