This file contains hidden or 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 <iostream> | |
#include <string> | |
#include <strstream> | |
#include <boost/property_tree/ptree.hpp> | |
#include <boost/property_tree/json_parser.hpp> | |
namespace pt = boost::property_tree; | |
int main(const int ac, const char* const * const av) | |
{ |
This file contains hidden or 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 <iostream> | |
#include <boost/program_options.hpp> | |
namespace po = boost::program_options; | |
int main(const int ac, const char* const * const av) | |
{ | |
// オプションの定義 | |
po::options_description description("option"); | |
description.add_options() |
This file contains hidden or 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 <iostream> | |
#include <boost/thread.hpp> | |
#define LOOP_NUM 5 | |
static int num = 0; | |
// mutex | |
boost::shared_mutex mtx_; |
This file contains hidden or 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 <iostream> | |
#include <boost/thread.hpp> | |
#define LOOP_NUM 5 | |
static int num = 0; | |
// mutex | |
boost::mutex mtx_; |
This file contains hidden or 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 <iostream> | |
#include <boost/thread.hpp> | |
#define LOOP_NUM 5 | |
static int count = 0; | |
// 再帰的にロックをとっても大丈夫なmutex | |
boost::recursive_mutex mtx_; |
This file contains hidden or 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 <iostream> | |
#include <boost/thread.hpp> | |
#define LOOP_NUM 5 | |
static int count = 0; | |
// mutex用の変数 | |
boost::mutex mtx_; |
This file contains hidden or 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 <iostream> | |
#include <boost/thread.hpp> | |
#define LOOP_NUM 5 | |
// 適当なクラス | |
class Hoge { | |
public: | |
// Hogeクラスのコンストラクタ |
This file contains hidden or 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 <iostream> | |
#include <boost/thread.hpp> | |
#define LOOP_NUM 5 | |
// 文字列を加工して返す関数 | |
std::string Modify(std::string str) { | |
std::cout << str << std::endl; | |
return str + " is modified."; |
This file contains hidden or 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 <iostream> | |
#include <boost/thread.hpp> | |
#define LOOP_NUM 5 | |
// 引数の文字列を標準出力する関数 | |
void Print(std::string str) { | |
for(int i = 0; i != LOOP_NUM; i++) { | |
// strの内容を標準出力(標準出力はスレッドセーフじゃないから本当は排他制御が必要だけど今回は省略) | |
std::cout << str << std::endl; |
This file contains hidden or 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 <iostream> | |
#include <boost/thread.hpp> | |
#define LOOP_NUM 5 | |
// hogehogeと標準出力する関数 | |
void Hoge() { | |
for(int i = 0; i != LOOP_NUM; i++) { | |
// hogehogeと標準出力(標準出力はスレッドセーフじゃないから本当は排他制御が必要だけど今回は省略) | |
std::cout << "hogehoge" << std::endl; |