chromium/third_party/libc++/src/include/__ranges/istream_view.h

// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP___RANGES_ISTREAM_VIEW_H
#define _LIBCPP___RANGES_ISTREAM_VIEW_H

#include <__concepts/constructible.h>
#include <__concepts/derived_from.h>
#include <__concepts/movable.h>
#include <__config>
#include <__fwd/istream.h>
#include <__fwd/string.h>
#include <__iterator/default_sentinel.h>
#include <__iterator/iterator_traits.h>
#include <__memory/addressof.h>
#include <__ranges/view_interface.h>
#include <__type_traits/remove_cvref.h>
#include <__utility/forward.h>
#include <cstddef>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#  pragma GCC system_header
#endif

#if _LIBCPP_STD_VER >= 20

_LIBCPP_BEGIN_NAMESPACE_STD

namespace ranges {

__stream_extractable;

template <movable _Val, class _CharT, class _Traits = char_traits<_CharT>>
  requires default_initializable<_Val> && __stream_extractable<_Val, _CharT, _Traits>
class basic_istream_view : public view_interface<basic_istream_view<_Val, _CharT, _Traits>> {
  class __iterator;

public:
  _LIBCPP_HIDE_FROM_ABI constexpr explicit basic_istream_view(basic_istream<_CharT, _Traits>& __stream)
      :{}

  _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {}

  _LIBCPP_HIDE_FROM_ABI constexpr default_sentinel_t end() const noexcept {}

private:
  basic_istream<_CharT, _Traits>* __stream_;
  _LIBCPP_NO_UNIQUE_ADDRESS _Val __value_ = _Val();
};

template <movable _Val, class _CharT, class _Traits>
  requires default_initializable<_Val> && __stream_extractable<_Val, _CharT, _Traits>
class basic_istream_view<_Val, _CharT, _Traits>::__iterator {};

istream_view;

#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
wistream_view;
#  endif

namespace views {
namespace __istream {

// clang-format off
template <class _Tp>
struct __fn {};
// clang-format on

} // namespace __istream

inline namespace __cpo {
istream;
} // namespace __cpo
} // namespace views

} // namespace ranges

_LIBCPP_END_NAMESPACE_STD

#endif // _LIBCPP_STD_VER >= 20

#endif // _LIBCPP___RANGES_ISTREAM_VIEW_H