VCCC  2024.05
VisualCamp Common C++ library
identity.hpp
Go to the documentation of this file.
1 //
2 // Created by YongGyu Lee on 12/28/23.
3 //
4 
5 #ifndef VCCC_FUNCTIONAL_IDENTITY_HPP
6 #define VCCC_FUNCTIONAL_IDENTITY_HPP
7 
8 #include <type_traits>
9 #include <utility>
10 
11 namespace vccc {
12 
15 
16 
25 struct identity {
26  template<typename T>
27  constexpr T&& operator()(T&& t) const noexcept {
28  return std::forward<T>(t);
29  }
30 
31  using is_transparent = std::true_type;
32 };
33 
35 
36 } // namespace vccc
37 
38 #endif // VCCC_FUNCTIONAL_IDENTITY_HPP
Definition: directory.h:12
function object that returns its argument unchanged
Definition: identity.hpp:25
std::true_type is_transparent
Definition: identity.hpp:31
constexpr T && operator()(T &&t) const noexcept
Definition: identity.hpp:27