Path: blob/main/contrib/llvm-project/libcxx/include/__iterator/projected.h
35233 views
// -*- C++ -*-1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//89#ifndef _LIBCPP___ITERATOR_PROJECTED_H10#define _LIBCPP___ITERATOR_PROJECTED_H1112#include <__config>13#include <__iterator/concepts.h>14#include <__iterator/incrementable_traits.h> // iter_difference_t15#include <__type_traits/remove_cvref.h>1617#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)18# pragma GCC system_header19#endif2021_LIBCPP_BEGIN_NAMESPACE_STD2223#if _LIBCPP_STD_VER >= 202425template <class _It, class _Proj>26struct __projected_impl {27struct __type {28using value_type = remove_cvref_t<indirect_result_t<_Proj&, _It>>;29indirect_result_t<_Proj&, _It> operator*() const; // not defined30};31};3233template <weakly_incrementable _It, class _Proj>34struct __projected_impl<_It, _Proj> {35struct __type {36using value_type = remove_cvref_t<indirect_result_t<_Proj&, _It>>;37using difference_type = iter_difference_t<_It>;38indirect_result_t<_Proj&, _It> operator*() const; // not defined39};40};4142// Note that we implement std::projected in a way that satisfies P2538R1 even in standard43// modes before C++26 to avoid breaking the ABI between standard modes (even though ABI44// breaks with std::projected are expected to have essentially no impact).45template <indirectly_readable _It, indirectly_regular_unary_invocable<_It> _Proj>46using projected = typename __projected_impl<_It, _Proj>::__type;4748#endif // _LIBCPP_STD_VER >= 204950_LIBCPP_END_NAMESPACE_STD5152#endif // _LIBCPP___ITERATOR_PROJECTED_H535455