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
// | |
#ifndef Engine_h | |
#define Engine_h | |
// #include <memory> | |
namespace { | |
class Engine { | |
public: | |
Engine(); |
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 <string> | |
#include <boost/property_tree/xml_parser.hpp> | |
#include <boost/property_tree/ptree.hpp> | |
#include <boost/foreach.hpp> | |
const std::string XML_PATH1 = "./test1.xml"; | |
int main() | |
{ | |
boost::property_tree::ptree pt1; |
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 <boost/regex.hpp> | |
#include <string> | |
#include <iostream> | |
int main() | |
{ | |
std::string s = "Boost Libraries"; | |
boost::regex expr{"\\w+\\s\\w+"}; | |
std::cout << std::boolalpha << boost::regex_match(s, expr) << '\n'; | |
} |
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 <boost/regex.hpp> | |
#include <string> | |
#include <iostream> | |
int main() | |
{ | |
std::string s = "Boost Libraries"; | |
boost::regex expr{"(\\w+)\\s(\\w+)"}; | |
boost::smatch what; | |
if (boost::regex_search(s, what, expr)) |
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 <boost/regex.hpp> | |
#include <string> | |
#include <iostream> | |
int main() | |
{ | |
std::string s = " Boost Libraries "; | |
boost::regex expr{"\\s"}; | |
std::string fmt{"_"}; | |
std::cout << boost::regex_replace(s, expr, fmt) << '\n'; |
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 <boost/regex.hpp> | |
#include <string> | |
#include <iostream> | |
int main() | |
{ | |
std::string s = "Boost Libraries"; | |
boost::regex expr{"(\\w)\\w+"}; | |
boost::regex_token_iterator<std::string::iterator> it{s.begin(), s.end(), | |
expr, 1}; |
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
class BasicSingleton | |
{ | |
public: | |
static BasicSingleton& getInstance(); | |
private: | |
BasicSingleton() {}; | |
BasicSingleton(const BasicSingleton& other); | |
static BasicSingleton instance; | |
}; |
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
class DynamicSingleton | |
{ | |
private: | |
DynamicSingleton() {}; | |
DynamicSingleton(const DynamicSingleton& other); | |
~DynamicSingleton() {}; | |
static DynamicSingleton* instance; | |
public: |
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 T > | |
class TemplateSingleton | |
{ | |
public: | |
static T * GetInstance() | |
{ | |
if (instance_ == NULL) | |
{ | |
instance_ = new T; | |
} |
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
class DynamicSingleton | |
{ | |
public: | |
static DynamicSingleton* GetInstance() | |
{ | |
if (instance_ == NULL) | |
{ | |
instance_ = new DynamicSingleton(); | |
} | |
return instance_; |
OlderNewer