您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

45 行
976B

  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