Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
ostreambuf_iterator.h76 linesDownload Raw Back to __iterator
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-exception7// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.8//9//===----------------------------------------------------------------------===//10 11#ifndef _LIBCUDACXX___ITERATOR_OSTREAMBUF_ITERATOR_H12#define _LIBCUDACXX___ITERATOR_OSTREAMBUF_ITERATOR_H13 14#ifndef __cuda_std__15#include <__config>16#endif // __cuda_std__17 18#include "../__iterator/iterator.h"19#include "../__iterator/iterator_traits.h"20#include "../cstddef"21#include "../iosfwd"22 23#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)24#  pragma GCC system_header25#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)26#  pragma clang system_header27#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)28#  pragma system_header29#endif // no system header30 31_LIBCUDACXX_BEGIN_NAMESPACE_STD32 33_LIBCUDACXX_SUPPRESS_DEPRECATED_PUSH34template <class _CharT, class _Traits>35class _LIBCUDACXX_TEMPLATE_VIS ostreambuf_iterator36#if _LIBCUDACXX_STD_VER <= 14 || !defined(_LIBCUDACXX_ABI_NO_ITERATOR_BASES)37    : public iterator<output_iterator_tag, void, void, void, void>38#endif39{40_LIBCUDACXX_SUPPRESS_DEPRECATED_POP41public:42    typedef _CharT                          char_type;43    typedef _Traits                         traits_type;44    typedef basic_streambuf<_CharT,_Traits> streambuf_type;45    typedef basic_ostream<_CharT,_Traits>   ostream_type;46private:47    streambuf_type* __sbuf_;48public:49    _LIBCUDACXX_INLINE_VISIBILITY ostreambuf_iterator(ostream_type& __s) noexcept50        : __sbuf_(__s.rdbuf()) {}51    _LIBCUDACXX_INLINE_VISIBILITY ostreambuf_iterator(streambuf_type* __s) noexcept52        : __sbuf_(__s) {}53    _LIBCUDACXX_INLINE_VISIBILITY ostreambuf_iterator& operator=(_CharT __c)54        {55            if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sputc(__c), traits_type::eof()))56                __sbuf_ = 0;57            return *this;58        }59    _LIBCUDACXX_INLINE_VISIBILITY ostreambuf_iterator& operator*()     {return *this;}60    _LIBCUDACXX_INLINE_VISIBILITY ostreambuf_iterator& operator++()    {return *this;}61    _LIBCUDACXX_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {return *this;}62    _LIBCUDACXX_INLINE_VISIBILITY bool failed() const noexcept {return __sbuf_ == 0;}63 64    template <class _Ch, class _Tr>65    friend66    _LIBCUDACXX_HIDDEN _LIBCUDACXX_HOST_DEVICE67    ostreambuf_iterator<_Ch, _Tr>68    __pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s,69                     const _Ch* __ob, const _Ch* __op, const _Ch* __oe,70                     ios_base& __iob, _Ch __fl);71};72 73_LIBCUDACXX_END_NAMESPACE_STD74 75#endif // _LIBCUDACXX___ITERATOR_OSTREAMBUF_ITERATOR_H76 
codekingpro/portable-devtools · Team Ai