diff --git a/functor.hpp b/functor.hpp index 9b0e4f85..4900d604 100644 --- a/functor.hpp +++ b/functor.hpp @@ -13,6 +13,20 @@ namespace cruft::functor { + /// Returns the supplied argument unchanged + /// + /// CXX#20: Revisit when C++20 support is available. This is just a + /// trivial implementation of std::identity. + struct identity { + template + ValueT&& + operator() (ValueT &&val) + { + return std::forward (val); + } + }; + + /// A trivial functor that wraps std::begin without any static typing. struct begin { template