-
Notifications
You must be signed in to change notification settings - Fork 6
/
SacoTAD.hpp
41 lines (37 loc) · 1019 Bytes
/
SacoTAD.hpp
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
#ifndef SACOTAD_HPP
#define SACOTAD_HPP
// Prof. Igor Machado Coelho
// Copyleft 2021 - MIT License
template <typename Agregado>
concept
#if __cplusplus <= 201703L // after c++20, not required 'bool'
bool
#endif
IteradorTAD = requires(Agregado a)
{
// requer operação 'terminou' (retorna booleano)
{a.terminou()};
// requer operação 'atual' (retorna elemento)
{a.atual()};
// requer operação 'proximo'
{a.proximo()};
};
template <typename Agregado>
concept
#if __cplusplus <= 201703L // after c++20, not required 'bool'
bool
#endif
SacoTAD = requires(Agregado a,
typename Agregado::Tipo t,
typename Agregado::ItTipo it)
{
// requer operação 'adiciona' sobre tipo 't'
{a.adiciona(t)};
// requer operação 'itera' (retorna 'it')
{a.itera()};
// requer operação 'busca' sobre tipo 't' (retorna 'it')
{a.busca(t)};
// requer operação 'remove'
{a.remove(it)};
};
#endif /* SACOTAD_HPP */