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
|
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2005 by Mike Sharov <msharov@users.sourceforge.net>
// This file is free software, distributed under the MIT License.
#include "stdtest.h"
void TestEnumArithmetic (void)
{
enum EFruit {
apple,
orange,
plum,
peach,
pear,
nectarine,
NFruits
};
const char* fruits [NFruits + 1] = {
"apple",
"orange",
"plum",
"peach",
"pear",
"nectarine",
"invalid"
};
cout << "Testing operator+" << endl;
cout << "apple = " << fruits [apple] << endl;
cout << "peach = " << fruits [apple + 3] << endl;
}
StdBvtMain (TestEnumArithmetic)
|