2015-01-01から1年間の記事一覧

github.io

htmlを生成するテンプレートエンジンJade Jade - Template Engine と,cssを生成するStylus Expressive, dynamic, robust CSS — expressive, robust, feature-rich CSS preprocessor の使い方について少し勉強したので,かねてより手を付けたいと思っていたg…

巷で流行りの活動日記

木構造系のデータ構造の実装のベストプラクティスが知りたいと思いつつ,適当に非常に簡単なものを試作するなど. 競プロ用途などで,自分用に簡単なprint機能などを備えた木構造のライブラリなどを作っておきたいという気持ちはある. TSから標準に入るopti…

Tower of Hanoi

#include <iostream> #include <stack> int main() { int n; std::cin >> n; std::stack<int> s[3]; for (int i = n; i > 0; --i) { s[0].push(i); } int mpos = 0; while (!s[0].empty() || !s[1].empty()) { s[(mpos + 1 + (n % 2)) % 3].push(s[mpos].top()); s[mpos].pop(); mp</int></stack></iostream>…

lambda is tuple

理解したのでメモ melpon.org #include <iostream> auto stack = [](auto... xs) { return [=](auto access) { return access(xs...); }; }; auto size = [](auto xs) { return xs([=](auto... z) { return sizeof...(z); }); }; auto push = [](auto xs, auto x) { re</iostream>…

型リストからindex_sequenceを作る

組込のfolding-exprを再帰深度O(1)とみなすと全体でも再帰深度O(1) melpon.org #include <type_traits> #include <utility> template<typename... Types> struct make_indices_from_types { private: template <std::size_t N, std::size_t...> struct make_indices { template <std::size_t M, std::size_t... Indices> make_indices</std::size_t></std::size_t></typename...></utility></type_traits>

printfに型チェックを付ける

どうもコンパイラ拡張で文字列を型パラメータとして取れるユーザ定義リテラルがあるようなので,printfに型チェックを付けるようなのを書いてみた. 桁数表示とか何も実装してないけれど,雰囲気がそれっぽくなってきたあたりで飽きた.もっと賢い実装方法が…

tuple_utility

jaredhoberock/tuple_utility · GitHub tuple_map, tuple_take, tuple_appendなど標準ライブラリに無いtuple操作ユーティリティのライブラリ.NVIDIA製. コードも短く,各操作の実装もシンプルで読みやすい.

tupleの実装解説記事

今年になってからスタートした丁寧なtuple実装解説の連載を見かけたので紹介しておきます. Implementing std::tuple From The Ground Up – Part 1: Introduction and Basic Structure http://blogs.microsoft.co.il/sasha/2015/01/12/implementing-tuple-pa…