📄 association.h
字号:
/* $Id: Association.h,v 1.2 1997/02/02 01:31:04 matt Exp $ Associations. (c) May 95 Matt Phillips */#ifndef _ASSOC_H#define _ASSOC_H#include "ContainerPresentation.h"template <class K, class T>class AssociationIter : public ContainerIter<T>{public: virtual const K &getKey () const = 0;};template <class K, class T>class Association : public ContainerPresentation<T>{public: virtual const char *name () const {return "Association";} virtual T &add (K &key, T &i) = 0; virtual int remove (const K &key) = 0; int exists (const K &key) const {return get (key) != 0;} virtual T *get (const K &key) const = 0; virtual AssociationIter<K, T> *makeIter () const = 0; virtual void printTo (ostream &os) const;};template <class K, class T>void Association<K, T>::printTo (ostream &os) const{ AssociationIter<K, T> *i; os << name () << endl; for (i = makeIter (); *i; (*i)++) os << " " << i->getKey () << " -> " << i->ref () << endl; delete i;}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -