This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <mutex> | |
class MySingleton { | |
public: | |
static MySingleton * GetInstance() { | |
std::call_once( | |
m_flag, | |
[] () { m_instance = new MySingleton(); } | |
); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Item { | |
int m_val1; | |
int m_val2; | |
Item (int val1, int val2) { | |
m_val1 = val1; | |
m_val2 = val2; | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename ... Ts> | |
struct ParamPack; | |
template <> | |
struct ParamPack<> { | |
static constexpr size_t count = 0; | |
}; | |
template <typename T, typename ... Ts> | |
struct ParamPack<T, Ts...> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Usage: | |
class Test; | |
bool Finalize (); | |
bool Finalize (int i); | |
bool Finalize (int i, int j); | |
{ |
OlderNewer