Mercurial > dwindows
changeset 2870:7b4e30c19757
C++: Disable singleton safety code for non C++11 compilers.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 18 Dec 2022 13:33:22 +0000 |
parents | c873b6f862b9 |
children | 4b7c4cd7a11d |
files | dw.hpp |
diffstat | 1 files changed, 3 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/dw.hpp Sun Dec 18 12:13:46 2022 +0000 +++ b/dw.hpp Sun Dec 18 13:33:22 2022 +0000 @@ -117,10 +117,13 @@ App() { } static App *_app; public: +// Allow the code to compile if handicapped on older compilers +#if __cplusplus >= 201103L // Singletons should not be cloneable. App(App &other) = delete; // Singletons should not be assignable. void operator=(const App &) = delete; +#endif // Initialization functions for creating App static App *Init() { if(!_app) { _app = new App; dw_init(TRUE, 0, NULL); } return _app; } static App *Init(const char *appid) { if(!_app) { _app = new App(); dw_app_id_set(appid, NULL); dw_init(TRUE, 0, NULL); } return _app; }