projected.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  3. //
  4. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  5. // See https://llvm.org/LICENSE.txt for license information.
  6. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #ifndef _LIBCPP___ITERATOR_PROJECTED_H
  10. #define _LIBCPP___ITERATOR_PROJECTED_H
  11. #include <__config>
  12. #include <__iterator/concepts.h>
  13. #include <__iterator/incrementable_traits.h>
  14. #include <type_traits>
  15. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  16. # pragma GCC system_header
  17. #endif
  18. _LIBCPP_BEGIN_NAMESPACE_STD
  19. #if !defined(_LIBCPP_HAS_NO_CONCEPTS)
  20. template<indirectly_readable _It, indirectly_regular_unary_invocable<_It> _Proj>
  21. struct projected {
  22. using value_type = remove_cvref_t<indirect_result_t<_Proj&, _It>>;
  23. indirect_result_t<_Proj&, _It> operator*() const; // not defined
  24. };
  25. template<weakly_incrementable _It, class _Proj>
  26. struct incrementable_traits<projected<_It, _Proj>> {
  27. using difference_type = iter_difference_t<_It>;
  28. };
  29. #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
  30. _LIBCPP_END_NAMESPACE_STD
  31. #endif // _LIBCPP___ITERATOR_PROJECTED_H