Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#include <boost/thread.hpp>
#define LOOP_NUM 5
// 適当なクラス
class Hoge {
public:
// Hogeクラスのコンストラクタ
#include <iostream>
#include <boost/thread.hpp>
#define LOOP_NUM 5
static int count = 0;
// mutex用の変数
boost::mutex mtx_;
#include <iostream>
#include <boost/thread.hpp>
#define LOOP_NUM 5
static int count = 0;
// 再帰的にロックをとっても大丈夫なmutex
boost::recursive_mutex mtx_;
#include <iostream>
#include <boost/thread.hpp>
#define LOOP_NUM 5
static int num = 0;
// mutex
boost::mutex mtx_;
#include <iostream>
#include <boost/thread.hpp>
#define LOOP_NUM 5
static int num = 0;
// mutex
boost::shared_mutex mtx_;
#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()
#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)
{
#include <iostream>
#include <string>
#include <strstream>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ini_parser.hpp>
namespace pt = boost::property_tree;
int main(const int ac, const char* const * const av)
{
# でコメント行を表す。
; もコメント行を表す。
### 基本的な書き方 ###
# []でセクション、<項目名=値>の形式で各項目を表す。値は全て文字列として扱われる。
[SECTION1]
HOGE=0123
# 同じ項目名が複数存在するとエラーになる。
# 大文字・小文字の区別はされないので以下のような値もエラーになるので注意。
import configparser
def main():
# configparserのインスタンスを生成
config = configparser.ConfigParser()
# コンフィグファイルを読み込み
config.read('./sample.conf')