32 lines
593 B
C++
32 lines
593 B
C++
#ifndef __MAP_H
|
|
|
|
#define __MAP_H
|
|
|
|
|
|
|
|
#include <iostream.h>
|
|
|
|
#include "List.h"
|
|
|
|
|
|
|
|
template <class KeyType, class DataType>
|
|
|
|
class Mapfake{
|
|
|
|
private:
|
|
|
|
typedef class Tuple{
|
|
|
|
KeyType key;
|
|
|
|
DataType data;
|
|
|
|
public:
|
|
|
|
Tuple(KeyType _key, DataType _data){key = _key; data = _data;}
|
|
|
|
|
|
|
|
KeyType getKey(){return key;}
|
|
|
|
DataType getData(){return data;}
|
|
|
|
} Tuple;
|
|
|
|
|
|
|
|
List<Tuple*> list;
|
|
|
|
|
|
|
|
public:
|
|
|
|
Mapfake();
|
|
|
|
|
|
|
|
DataType find(KeyType key);
|
|
|
|
bool exist(KeyType key);
|
|
|
|
bool add(KeyType key, DataType data);
|
|
|
|
int getSize();
|
|
|
|
};
|
|
|
|
|
|
|
|
#include "mapfake.cpp"
|
|
|
|
#endif |