C++相談室 part11
■ このスレッドは過去ログ倉庫に格納されています
0806デフォルトの名無しさん
NGNGnamespace std
{
struct less<Particle*>: public binary_function<hoge const *, hoge const*, bool>
{
bool operator()(hoge* const a, hoge* const b)
{
return a->val < b->val;
}
};
};
std::list<hoge*> hogelist;
・・・//hogelistにnewしたhoge*を追加
hogelist.sort(std::less<hoge*>());
のようにしています。
・stdに手を入れていること
・hoge*に特化したstd::less<hoge*>を使っていること
の2点でよくないような気がするのですが、他の方法はありますか?
■ このスレッドは過去ログ倉庫に格納されています