2010-11-18から1日間の記事一覧

ある区間の上限/下限を求める

C++

STL の upper_bound / lower_bound を使ってみたらハマったので、日記のネタに。 結論を書くと、 std::upper_bound( first, last, x ) は、区間 [ iter, last ) が std::equal_range( first, last, x ) の上界となるような iter を、 std::lower_bound( firs…