source: proiecte/swift/trunk/lib/hoard-371/src/exactlyone.h @ 176

Last change on this file since 176 was 176, checked in by (none), 14 years ago
  • imported repo from "guagal"
File size: 397 bytes
RevLine 
[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
10namespace Hoard {
11
12template <class CLASS>
13class ExactlyOne {
14public:
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.