2011-09-15から1日間の記事一覧

文字列を空白で区切る

文字列を空白で区切ってリストに変換する, Haskell で言う words 的な処理が Python で必要になったので,書いてみた. import re def words(s): return re.findall( r"\S+", s ) words( "hoge fuga \n piyo" ) # ["hoge", "fuga", "piyo"] 正規表現さん素…

const は消えていない

const が消える件… - 危ないRiSKのブログ 結論を書くと,別に const は消えていない. 単に T が int const& に推論されているだけだ. // 型名のデマングル用 utility // thanks to http://cpplover.blogspot.com/2010/03/gcc.html #include <cxxabi.h> #include <cstdlib> // </cstdlib></cxxabi.h>…