Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
upper_bound With binary_function Visual Studio 2008 Bug?
#include <algorithm> #include <functional> #include <iostream> #include <vector> using namespace std; struct Foo { int a; char b; }; struct comp : binary_function<const double, const Foo&, bool> { bool operator () (const double lhs, const Foo& rhs) { return lhs < rhs.a; } }; int main() { vector<Foo> test; for(int i = 0; i < 5; ++i) { Foo foo = { i + 1, 'a' + i }; test.push_back(foo); } cout << upper_bound(test.begin(), test.end(), 2, comp())->b << endl; }
run
|
edit
|
history
|
help
0
a parameter pack
Wide string conversion with multibyte chars and locale
#27
StreamParam
MSVC-IsBaseOf
reference
hangman
Runner-mt
Program_2
VC++ Template Comment