You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

identity.hpp 976B

5 yıl önce
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /// \file
  2. // Range v3 library
  3. //
  4. // Copyright Eric Niebler 2013-present
  5. //
  6. // Use, modification and distribution is subject to the
  7. // Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. //
  11. // Project home: https://github.com/ericniebler/range-v3
  12. //
  13. #ifndef RANGES_V3_FUNCTIONAL_IDENTITY_HPP
  14. #define RANGES_V3_FUNCTIONAL_IDENTITY_HPP
  15. #include <range/v3/detail/config.hpp>
  16. namespace ranges
  17. {
  18. /// \addtogroup group-functional
  19. /// @{
  20. struct identity
  21. {
  22. template<typename T>
  23. constexpr T && operator()(T && t) const noexcept
  24. {
  25. return (T &&) t;
  26. }
  27. using is_transparent = void;
  28. };
  29. /// \cond
  30. using ident RANGES_DEPRECATED("Replace uses of ranges::ident with ranges::identity") =
  31. identity;
  32. /// \endcond
  33. namespace cpp20
  34. {
  35. using ranges::identity;
  36. }
  37. /// @}
  38. } // namespace ranges
  39. #endif