LibMusicXML  3.18
singleton.h
1 /*
2  MusicXML Library
3  Copyright (C) Grame 2006-2013
4 
5  This Source Code Form is subject to the terms of the Mozilla Public
6  License, v. 2.0. If a copy of the MPL was not distributed with this
7  file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9  Grame Research Laboratory, 11, cours de Verdun Gensoul 69002 Lyon - France
10  research@grame.fr
11 */
12 
13 #ifndef __singleton__
14 #define __singleton__
15 
16 // warning: this is NOT a thread safe implementation
17 template <typename T> class singleton {
18  public:
19  static T& instance () {
20  static T theSingleInstance;
21  return theSingleInstance;
22  }
23 };
24 
25 
26 #endif
singleton
Definition: singleton.h:17