-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathColecao.h
46 lines (39 loc) · 834 Bytes
/
Colecao.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
///////////////Colecao.h (vrs. 13/Dez/2018)////////////////
#pragma once
#include<set>
using namespace std;
template<class K>
class Colecao : public set<K> {
public:
bool insert(const K &c);
K *find(const K &c) const;
int size() const;
void erase(const K &);
//void clear();
//bool empty() const;
//iterator begin();
//iterator end();
};
template<class K>
bool Colecao<K>::insert(const K &c)
{
pair<set<K>::iterator, bool> r = set<K>::insert(c);
return(r.second);
}
template<class K>
K *Colecao<K>::find(const K &c) const
{
K *r = 0;
typename set<K>::iterator i = set<K>::find(c);
if (i != set<K>::end())
r = const_cast<K*>(i.operator->());
return(r);
}
template<class K>
int Colecao<K>::size() const {
return((int)set<K>::size());
}
template<class K>
void Colecao<K>::erase(const K &c) {
set<K>::erase(c);
}