Skip to content

Instantly share code, notes, and snippets.

@elimohl
Last active January 4, 2019 18:11
Show Gist options
  • Select an option

  • Save elimohl/8b679f93155d68936a7c23712b371aa4 to your computer and use it in GitHub Desktop.

Select an option

Save elimohl/8b679f93155d68936a7c23712b371aa4 to your computer and use it in GitHub Desktop.
#include <functional>
#include <vector>
#include <iostream>
using std::vector;
template <typename A, typename U = std::less<>>
bool f(typename vector<A>::iterator a, typename vector<A>::iterator b, U u = U());
bool Less(int a, int b) {
return a < b;
}
int main()
{
std::cout << std::boolalpha;
std::cout << f(vector<int>{5}.begin(), vector<int>{20}.begin()) << '\n';
}
template <typename A, typename U = std::less<>>
bool f(typename vector<A>::iterator a, typename vector<A>::iterator b, U u)
{
return u(*a, *b);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment