Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
catch_singletons.cpp
Go to the documentation of this file.
1/*
2 * Created by Phil Nash on 15/6/2018.
3 *
4 * Distributed under the Boost Software License, Version 1.0. (See accompanying
5 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 */
7
9
10#include <vector>
11
12namespace Catch {
13
14 namespace {
15 static auto getSingletons() -> std::vector<ISingleton*>*& {
16 static std::vector<ISingleton*>* g_singletons = nullptr;
17 if( !g_singletons )
18 g_singletons = new std::vector<ISingleton*>();
19 return g_singletons;
20 }
21 }
22
24
25 void addSingleton(ISingleton* singleton ) {
26 getSingletons()->push_back( singleton );
27 }
29 auto& singletons = getSingletons();
30 for( auto singleton : *singletons )
31 delete singleton;
32 delete singletons;
33 singletons = nullptr;
34 }
35
36} // namespace Catch
void addSingleton(ISingleton *singleton)
void cleanupSingletons()