blob: a0b66a6a62a40f98168b75cdb6ae3fc6bfc560a7 [file] [log] [blame]
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_FUNCTIONAL_IDENTITY_H_
#define BASE_FUNCTIONAL_IDENTITY_H_
#include <utility>
namespace gurl_base {
// Implementation of C++20's std::identity.
//
// Reference:
// - https://en.cppreference.com/w/cpp/utility/functional/identity
// - https://wg21.link/func.identity
struct identity {
template <typename T>
constexpr T&& operator()(T&& t) const noexcept {
return std::forward<T>(t);
}
using is_transparent = void;
};
} // namespace base
#endif // BASE_FUNCTIONAL_IDENTITY_H_