1 // All the pointer_to_binary_function cases used to fail because g++
2 // couldn't handle converting an overloaded function to a class type.
3 // The first one should still fail because it requires an implicit conversion
4 // to pointer_to_binary_function, which has an `explicit' constructor.
12 template <class T> class Expr
20 inline bool compare(const Expr<T> a, const Expr<T> b){ return true; };
25 sort( a.begin(), a.end(),
26 static_cast<bool (*)(const Expr<int>,const Expr<int>)>(compare) );
27 sort( a.begin(), a.end(), compare<int> );
28 sort<vector<int>::iterator,
29 pointer_to_binary_function<const Expr<int>, const Expr<int>, bool> >
30 ( a.begin(), a.end(), compare ); // ERROR - constructor is explicit
31 sort( a.begin(), a.end(),
32 ptr_fun<const Expr<int>, const Expr<int>, bool> (compare) );
33 sort( a.begin(), a.end(),
34 ptr_fun(compare<int>) );
35 sort( a.begin(), a.end(),
36 pointer_to_binary_function<const Expr<int>, const Expr<int>, bool>(compare) );
37 sort( a.begin(), a.end(),
38 pointer_to_binary_function<const Expr<int>, const Expr<int>, bool>(compare<int>) );
39 sort( a.begin(), a.end(),
40 pointer_to_binary_function<const Expr<int>, const Expr<int>, bool>(compare<>) );