Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum Color { Red,Green,Blue };
- enum Size { Big,Little };
- void f( Color c ) {
- }
- void f( Size s ) {
- }
- int main() {
- f( Red );
- f( Big );
- }
- int f(int fg, int bg)
- int f(COLOR fg, COLOR bg)
- template <int N>
- struct foo
- {
- enum { Value = foo<N-1>::Value + N };
- };
- template <>
- struct foo<0>
- {
- enum { Value = 0; }
- };
- template <int N>
- struct foo
- {
- static const int Value = foo<N-1>::Value + N;
- };
- template <>
- struct foo<0>
- {
- static const int Value = 0;
- };
- #include <iostream>
- using namespace std;
- class Bunch {
- enum { size = 1000 };
- int i[size];
- };
- int main() {
- cout << "sizeof(Bunch) = " << sizeof(Bunch)
- << ", sizeof(i[1000]) = "
- << sizeof(int[1000]) << endl;
- }
- enum {NONE, START, HEY, HO, LAST};
- for (int i = NONE; i < LAST; i++)
- {
- // Do stuff...
- }
- enum {NONE, START, HEY, WEE, HO, LAST};
- class Foo {
- static const int MAX_LEN = 80;
- ...
- };
- class Foo {
- enum {
- MAX_LEN = 80
- };
- ...
- };
- enum my_new_fangled_type {
- baz = 0,
- meh = 1
- };
- void foo (my_new_fangled_type bar) // bar can be a value listed in the enum
- {
- ...
- }
- int const baz = 0;
- int const meh = 1;
- void foo (int bar) // what are valid values for bar?
- {
- ...
- }
- class C
- {
- const int ARealConstant = 10;
- };
- class C
- {
- enum { ARealConstant = 10 };
- };
- class DirectorySearcher
- {
- enum options
- {
- showFiles = 0x01,
- showDirectories = 0x02,
- showLinks = 0x04,
- };
- };
- class Integer
- {
- enum { treatAsNumeric = true };
- enum { treatAsIntegral = true };
- enum { treatAsString = false };
- };
- enum { Val1, Val2, Val3 };
- const int Val1=0, Val2=1, Val3=2;
Add Comment
Please, Sign In to add comment