2009-04-01から1ヶ月間の記事一覧

mpl勉強モード

C++

enable_ifを使ってテンプレートメンバー関数を特殊化してみた? #include <iostream> #include <string> #include <typeinfo> #if defined(__GNUC__) #include <type_traits> #include <cxxabi.h> #endif #if !defined(__GNUC__) template <bool b, class T> struct enable_if; template <class T> struct enable_if<true, T> { typedef T type; }; #…</true,></class></bool></cxxabi.h></type_traits></typeinfo></string></iostream>

Scalaメモ

http://itpro.nikkeibp.co.jp/article/COLUMN/20080613/308019/ ここ全部読む。

Windows版gcc4.4でC++0xのコードをコンパイルに`c++0x'だけではダメ

C++

コンパイルオプションに`-std=c++0x'だけではダメで、`gnu++0x'も指定する必要があります。 (もしくは`gnu++0x'だけでも良いかもしれません。) 結論としては`-std=c++0x'ではなく、`-std=gnu++0x'を指定しなければいけません。 C++0xのコードをコンパイルす…