std::binary_function 未定义问题
使用高版本C++编译器编译旧的SDK的时候,SDK代码中会含有一些已经废弃的函数;如std::binary_function
修改方式:
原始代码:
namespace { struct NameCompare: std::binary_function <const char *, const char *, bool> { bool operator () (const char *x, const char *y) const { return strcmp (x, y) < 0; } };
修改后:
template<class Arg1, class Arg2, class Result> struct binary_function { using first_argument_type = Arg1; using second_argument_type = Arg2; using result_type = Result; }; template <typename ArgumentType, typename ResultType> struct unary_function { using argument_type = ArgumentType; using result_type = ResultType; }; namespace { struct NameCompare: binary_function <const char *, const char *, bool> { bool operator () (const char *x, const char *y) const { return strcmp (x, y) < 0; } };