Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronize identity with C++20 #153

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions MyTinySTL/functional.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ struct logical_not :public unarg_function<T, bool>
};

// 证同函数:不会改变元素,返回本身
template <class T>
struct identity :public unarg_function<T, bool>
struct identity
{
const T& operator()(const T& x) const { return x; }
template <class T>
constexpr T&& operator()(T&& x) const noexcept { return static_cast<T&&>(x); }
};

// 选择函数:接受一个 pair,返回第一个元素
Expand Down