n
遅延評価してフィルタリングされたベクトルの th 要素を返す関数を書きたいと思います。ほとんどの場合、ベクトルの最初または 2 番目の要素に関心があります。n
したがって、リスト全体をフィルタリングしてからth 要素を見つけたくありません。
Boost の使用方法を学んでいます。Boost を使用した簡単な解決策があれば、非常に有益です。
int main() {
double x[] = {10, 12.5, 12.9, 13.7, 50.07};
size_t length = sizeof(x)/sizeof(x[0]);
std::vector<double> vx(x, x+length);
// Need a function to filter out elements less than 11 and return the 2nd
// element greater than 11 (here 12.9) and return without evaluating 13.7 and 50.07
return 0;
}