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
|
#include <iostream>
#include <stdexcept>
using namespace std;
#include "set.h"
template<>
const bool
ASCXX_Set<long>::isCorrectType() const{
return (SetKind(s)==integer_set);
}
template<>
const bool
ASCXX_Set<SymChar>::isCorrectType() const{
return (SetKind(s)==string_set);
}
template<>
const bool
ASCXX_Set<Empty>::isCorrectType() const{
return (SetKind(s)==string_set);
}
template<>
const long
ASCXX_Set<long>::operator[](const unsigned long &i) const{
return FetchIntMember(s,i);
}
template<>
const SymChar
ASCXX_Set<SymChar>::operator[](const unsigned long &i) const{
return SymChar(SCP(FetchStrMember(s,i)));
}
template<>
const Empty
ASCXX_Set<Empty>::operator[](const unsigned long &i) const{
throw runtime_error("Invalid attempt to retreive item from empty set");
}
|