MTSL/h/function_like_classes.h

16 lines
304 B
C++

//
// Created by dongl on 22-9-28.
//
#ifndef MSTL_FUNCTION_LIKE_CLASSES_H
#define MSTL_FUNCTION_LIKE_CLASSES_H
#endif //MSTL_FUNCTION_LIKE_CLASSES_H
/// 仿函数 类 看起来像一个 函数
template<class T>
struct identity{
const T& operator()(const T& x) const {
return x;
}
};