掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
多次元配列のソートについて (ID:58068)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
解決とあるものの,誰も言わなかったので一応。 qsortではなくstd::sortを使えばキャストの問題は全て解決します。 個人的には,この方法を推奨。 ref) Effective STL 第46項 #include <functional> // 追加 #include <algorithm> // 追加 struct compare_mdf : std::binary_function<SYM_INFO, SYM_INFO, bool) { bool operator() (const SYM_INFO & lhs, const SYM_INFO & rhs) const { return strcmp(lhs.name, rhs.name) < 0; } }; // main内 std::sort(sym_tbl, sym_tbl + sym_number, compare_mdf());
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.