codekingpro/portable-devtools
114k
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_OSTREAM_ITERATOR_H12#define _LIBCUDACXX___ITERATOR_OSTREAM_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 "../__memory/addressof.h"21#include "../cstddef"22#include "../iosfwd"23 24#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)25# pragma GCC system_header26#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)27# pragma clang system_header28#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)29# pragma system_header30#endif // no system header31 32_LIBCUDACXX_BEGIN_NAMESPACE_STD33 34_LIBCUDACXX_SUPPRESS_DEPRECATED_PUSH35template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT> >36class _LIBCUDACXX_TEMPLATE_VIS ostream_iterator37#if _LIBCUDACXX_STD_VER <= 14 || !defined(_LIBCUDACXX_ABI_NO_ITERATOR_BASES)38 : public iterator<output_iterator_tag, void, void, void, void>39#endif40{41_LIBCUDACXX_SUPPRESS_DEPRECATED_POP42public:43 typedef _CharT char_type;44 typedef _Traits traits_type;45 typedef basic_ostream<_CharT,_Traits> ostream_type;46private:47 ostream_type* __out_stream_;48 const char_type* __delim_;49public:50 _LIBCUDACXX_INLINE_VISIBILITY ostream_iterator(ostream_type& __s) noexcept51 : __out_stream_(_CUDA_VSTD::addressof(__s)), __delim_(0) {}52 _LIBCUDACXX_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter) noexcept53 : __out_stream_(_CUDA_VSTD::addressof(__s)), __delim_(__delimiter) {}54 _LIBCUDACXX_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value_)55 {56 *__out_stream_ << __value_;57 if (__delim_)58 *__out_stream_ << __delim_;59 return *this;60 }61 62 _LIBCUDACXX_INLINE_VISIBILITY ostream_iterator& operator*() {return *this;}63 _LIBCUDACXX_INLINE_VISIBILITY ostream_iterator& operator++() {return *this;}64 _LIBCUDACXX_INLINE_VISIBILITY ostream_iterator& operator++(int) {return *this;}65};66 67_LIBCUDACXX_END_NAMESPACE_STD68 69#endif // _LIBCUDACXX___ITERATOR_OSTREAM_ITERATOR_H70 