私は3つのフィールドを含む構造体の配列を持っています:
struct data{
   int s;
   int f;
   int w;   
};
struct data a[n];
フィールド f に基づいて構造体の配列をソートするために、独自の比較演算子を使用しています。
bool myf( struct data d1,const struct data d2){
   return d1.f < d2.f ; 
}
上記の演算子は、組み込みsort()関数で正常に機能します。
 sort(a,a+n,myf);
しかし、それは関数ではupper_bound()機能しません:
 upper_bound(a,a+n,someValue,myf); 
誰が私がどこで間違っているのか教えてもらえますか? 私の比較演算子は間違っていますか? 間違っている場合、なぜそれが機能するのsort() function and not upper_bound()ですか?
私はコンパイルで次のようになっています:
    /usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_algo.h: In function     ‘_FIter std::upper_bound(_FIter, _FIter, const _Tp&, _Compare) [with _FIter = data*, _Tp =     int, _Compare = bool (*)(data, data)]’:
   prog.cpp:37:   instantiated from here
    /usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_algo.h:2243: error: conversion from ‘const int’ to non-scalar type ‘data’ requested