2005-02-01から1ヶ月間の記事一覧

cpp2hatena スタイルシートの例(eclipse風)

span.cpp_keyword { color: #7F0055 } span.cpp_string_literal { color: #2A00FF } span.cpp_number_literal { } span.cpp_pp_directive { color: #7F9FBF; font-weight: bolder } span.cpp_pp_include_path { color: #2A00FF } span.cpp_pp_pragma_token {…

cpp2hatena.cpp

[]// code2xml.cpp : コンソール アプリケーションのエントリ ポイントを定義します。[] []//[][]#include[][] "stdafx.h"[][]#include[][] <fstream>[] []#include[][] <iostream>[] []#include[][] <sstream>[] []#include[][] <string>[]</string></sstream></iostream></fstream>

cpp2hatena.hpp

[]#pragma[] []once[][]// thanks to[] []// http://spirit.sourceforge.net/distrib/spirit_1_7_0/libs/spirit/example/application/cpp_to_html/[][]#include[][] <boost/spirit/core.hpp>[] []#include[][] <boost/spirit/utility/chset.hpp>[] []#include[][] <boost/spirit/utility/escape_char.hpp>[] []#include[][]…</boost/spirit/utility/escape_char.hpp></boost/spirit/utility/chset.hpp></boost/spirit/core.hpp>

Boost.FunctionTraitsについて

boost::functionとboost::function_traitsは関数ポインタ型をサポートしていない function_traitsはわざわざadd_pointerしたあと、Specializationしている おそらく使用の推奨されないfuncionalのunary_traitsとbinary_traitsはサポートしている それらの代…

boost::mpl::inherit_linearlyとLoki::Gen***Hierarchyの関係

Modern C++ Design Section 3.13をboost::mplで書ける mpl::inherit_"linearly"は同書の"LinearHierarchy"を示しているのではないことに注意 #include <[]boost[]/mpl/inherit.hpp> #include <[]boost[]/mpl/inherit_linearly.hpp> #include <[]boost[]/mpl/…

boost::mpl::Assertsの実装の概要

#include <[]boost[]/mpl/bool.hpp> #include <[]boost[]/mpl/eval_if.hpp>namespace question { struct X { int a; }; int X::* what_is_this(); int X::** what_is_that(); inline void test_X() { X x; // pointer to member a int X::*p2a = &X::a; x.*p…

英語の書き方

D'Nealian Handwriting 活字体 D'Nealian Handwriting 筆記体 亀甲文字の筆記体 World Handwriting Contest

The Curiously Recurring Template Pattern

C++

略して「CRTP」 訳すと「(派生クラスを)詮索する再帰テンプレートパターン」 C++プログラミングの筋と定石のJames O. Coplienが紹介した ダウンキャストに名前までついており、「Barton and Nackman trick」と言う WTLでよく使われる template <typename T_child> struct paren</typename>…

boost::mpl::identityとboost::type

#include <iostream> #include <[]boost[]/mpl/identity.hpp> #include <boost/mpl/for_each.hpp> #include <boost/mpl/vector.hpp> #include <boost/type.hpp>namespace pst { namespace mpl = boost::mpl; struct my_print_type { // mpl-style template <typename T> void operator()(mpl::identity<T>) const { std::co…</t></typename></boost/type.hpp></boost/mpl/vector.hpp></boost/mpl/for_each.hpp></iostream>

Class Composition

C++

#include <boost/mpl/inherit.hpp> #include <boost/mpl/inherit_linearly.hpp> #include <boost/lambda/construct.hpp> namespace pst { namespace mpl = boost::mpl; namespace lam = boost::lambda; using mpl::_1; using mpl::_2; template <typename Sequence> struct factory : mpl::inherit_linearly< Sequence, mpl…</typename></boost/lambda/construct.hpp></boost/mpl/inherit_linearly.hpp></boost/mpl/inherit.hpp>

Boost.MPLの概念

Metafunction Metafunction Class Lambda Expression Placeholder Expression

Metafunction Forwarding

// struct mf1 : mf2 { }; は // Metafunctionが等しいこと(mf1 = mf2) template <typename T_tiny> struct tiny_at<T_tiny, 0> : mpl::identity<typename T_tiny::t0> { // typedef T_tiny::t0 type; };</typename></t_tiny,></typename>