studies

いろいろ勉強用備忘録的な感じ

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

無名共用体を見かけた

無名共用体(anonymous union)を久しぶりに見た。無名共用体というのは、こんなやつ。 #include <iostream> using namespace std; static struct { char dummy; union { // これが無名共用体よ long data_double_word; struct { // これは無名構造体だ // リトルエンデ</iostream>…

pythonで順序を保つグルーピング

恒例の?問題をpythonでやってみる。 使うアルゴリズムは、perlで最後にやったのと同じ(いちおうバケットソートといえるだろうか?) studies.hatenablog.compythonのcollectionモジュールにあるOrderedDict(順序付き辞書)を使うと楽に書ける。 OrderedDi…