↓この本の第5章 Producer-ConsumerパターンをC++で書いてみた。 増補改訂版 Java言語で学ぶデザインパターン入門 マルチスレッド編 作者: 結城浩出版社/メーカー: ソフトバンククリエイティブ発売日: 2006/03/21メディア: 大型本購入: 15人 クリック: 287回この商品を含むブログ (203件) を見る 処理の流れとしては、ケーキを作る人(スレッド)が3人、ケーキを食べる人が3人、作ったケーキを置いておくテーブルの面積がケーキ3つ分、という風になっています。面倒くさいのでファイルは分割しませんでしたが、本のサンプルと対比はし易いかと思います。 #include <iostream> #include <chrono> #include <atomic> #include <thread> #include <condition_variable> #in
(BER) MetaOCaml is a conservative extension of OCaml for ``writing programs that generate programs''. MetaOCaml adds to OCaml the type of code values (denoting ``program code'', or future-stage computations), and two basic constructs to build them: quoting and splicing. The generated code can be printed, stored in a file -- or compiled and linked-back to the running program, thus implementing run-
In his "Variadic Templates are Funadic" talk at GoingNative 2012 Andrei Alexandrescu outlines a "recursive" implementation of std::tuple. He also notes that most implementations arrange tuple members in memory in the "wrong" order, that is, std::tuple<int, double, std::string> will have a memory layout where the std::string comes first and the int comes last. The straightforward recursive implemen
中3女子です。 今回は、constexpr におけるアルゴリズムの実装法について考える。 よく知られているように、constexpr 関数には言語規格上の制約が多くある。 ローカル変数が使えない、if や for などの制御構文が使えないなどは、C++11 に触れた者なら誰でも知っているだろう。 だが、それらは条件演算子や再帰によって、単純に代替できる問題である。 つまり、非 constexpr な実装に対して、処理の流れを本質的に変えることなく constexpr に書き換えることができる。 単純に書き換えられる例: template<typename T> T const& runtime_min(T const& a, T const& b) { if (b < a) return b; return a; } template<typename T> constexpr T con
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く