diff --git a/functor.hpp b/functor.hpp index fd0013bc..8ad31dfb 100644 --- a/functor.hpp +++ b/functor.hpp @@ -12,6 +12,32 @@ namespace cruft::functor { + /// A trivial functor that wraps std::begin without any static typing. + struct begin { + template + decltype (auto) + operator() (valuet &&value) noexcept (noexcept (std::begin (value))) + { + return std::begin ( + std::forward (value) + ); + } + }; + + + /// A trivial functor that wraps std::end without any static typing. + struct end { + template + decltype (auto) + operator() (valuet &&value) noexcept (noexcept (std::end (value))) + { + return std::end ( + std::forward (value) + ); + } + }; + + /////////////////////////////////////////////////////////////////////////// /// returns the value provided at construction time regardless of the /// arguments supplied in the call operator.