| 1 |
sf-pippijn |
1.1 |
/* support.hh |
| 2 |
|
|
* This file is part of ncursesxx library |
| 3 |
|
|
* Copyright (c) 2003,2004 by Stanislav Ievlev |
| 4 |
|
|
* |
| 5 |
|
|
* This file is covered by the GNU Library General Public License, |
| 6 |
|
|
* which should be included with libncursesxx as the file COPYING. |
| 7 |
|
|
*/ |
| 8 |
|
|
#ifndef NCURSESXX_SUPPORT_HH__ |
| 9 |
|
|
#define NCURSESXX_SUPPORT_HH__ |
| 10 |
|
|
|
| 11 |
|
|
#include <algorithm> |
| 12 |
|
|
|
| 13 |
|
|
namespace ncurses |
| 14 |
|
|
{ |
| 15 |
|
|
template<class T> |
| 16 |
|
|
class singleton_holder |
| 17 |
|
|
{ |
| 18 |
|
|
/**< simple Meyers' style singleton */ |
| 19 |
|
|
public: |
| 20 |
|
|
typedef T obj_type; |
| 21 |
|
|
static T & |
| 22 |
|
|
instance () /**< @return instance of the object */ |
| 23 |
|
|
{ |
| 24 |
|
|
static T obj; |
| 25 |
|
|
|
| 26 |
|
|
return obj; |
| 27 |
|
|
} |
| 28 |
|
|
|
| 29 |
|
|
private: |
| 30 |
|
|
/* all this operations are unavailable to ordinal users */ |
| 31 |
|
|
singleton_holder (); |
| 32 |
|
|
singleton_holder (const singleton_holder &s); |
| 33 |
|
|
singleton_holder &operator = (const singleton_holder &s); |
| 34 |
|
|
~singleton_holder (); |
| 35 |
|
|
}; |
| 36 |
|
|
} |
| 37 |
|
|
|
| 38 |
|
|
#endif |