I came across a class template std::unary_functionand std::binary_function.
std::unary_function
std::binary_function
template <class Arg, class Result> struct unary_function { typedef Arg argument_type; typedef Result result_type; }; template <class Arg1, class Arg2, class Result> struct binary_function { typedef Arg1 first_argument_type; typedef Arg2 second_argument_type; typedef Result result_type; };
Both can be used as a base class for specific purposes. But there is no virtual destructor in this. One of the reasons that I could guess about is that they are not designed to be polymorphic. i.e
std::unary_function* ptr; //intialize it //do something delete ptr;
But if this is the case, there should not be a destructor with protectedan access specifier for the compiler to violate any attempt to do this.
protected
++ "" - , , , . , . , unary_function, binary_function, iterator .., , . .
unary_function
binary_function
iterator
, " " , . . .
- ... , . , - ( typedef s).
typedef
, unary_function, binary_function , iterator . . , ++ Mixins ..
std::unary_function std::binary_function : typedefs .
++, , - .
. , :
void foo(std::unary_function* f) { delete f; // illegal }
, , ++ 11 (. N3145)
, (, std::iterator<...>) , , , , STL, , . , , , , - , "--". , .
std::iterator<...>
STL , STL . , , , , - . , .
- ++ 11 ( , ), , "" ( , ).
Source: https://habr.com/ru/post/1568794/More articles:Android Flurry ad not showing - androidWhy is Long unable to accept a 12-digit value, even if I explicitly declared it? - javaThe difference in performance and memory consumption between Array and ArrayList - javaArraylist and arrays - javaFPU Instructions That Verify Accuracy - x86Django and AJAX: remove multiple checkbox elements - checkboxHow to manage toastr parameters (or set them around the world) using a controller or Angular module - angularjsHow to implement the preferred read and write for * nix - linuxAuthentication of AngularStack Facebook, Google+ and Twitter - angularjsКак я могу узнать, действительна ли покупка, не потребляемая в приложении, с использованием конечной точки проверки поступления яблок - iosAll Articles