yohhoyの日記

技術的メモをしていきたい日記

2012-02-18から1日間の記事一覧

tieを用いた比較演算子の実装

C++

C++11標準ライブラリで追加されたタプルを利用し、ユーザ定義型の比較演算子を簡単に実装する方法。 #include <tuple> // ユーザ定義型 struct Person { std::string lname; // last name std::string fname; // family name int age; }; bool operator<(const Pers</tuple>…