source:
proiecte/swift/trunk/lib/hoard-371/src/exactlyone.h
@
176
Last change on this file since 176 was 176, checked in by , 14 years ago | |
---|---|
File size: 397 bytes |
Rev | Line | |
---|---|---|
[176] | 1 | #ifndef _EXACTLYONE_H_ |
2 | #define _EXACTLYONE_H_ | |
3 | ||
4 | /** | |
5 | * @class ExactlyOne | |
6 | * @brief Creates a singleton of type CLASS, accessed through (). | |
7 | * @author Emery Berger <http://www.cs.umass.edu/~emery> | |
8 | */ | |
9 | ||
10 | namespace Hoard { | |
11 | ||
12 | template <class CLASS> | |
13 | class ExactlyOne { | |
14 | public: | |
15 | ||
16 | inline CLASS& operator() (void) { | |
17 | static CLASS theOneTrueInstance; | |
18 | return theOneTrueInstance; | |
19 | } | |
20 | ||
21 | }; | |
22 | ||
23 | }; | |
24 | ||
25 | #endif | |
26 |
Note: See TracBrowser
for help on using the repository browser.