Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
insert_iterator.h74 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_INSERT_ITERATOR_H12#define _LIBCUDACXX___ITERATOR_INSERT_ITERATOR_H13 14#ifndef __cuda_std__15#include <__config>16#endif // __cuda_std__17 18#include "../__iterator/iterator_traits.h"19#include "../__iterator/iterator.h"20#include "../__memory/addressof.h"21#include "../__utility/move.h"22#include "../cstddef"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 _Container>36class _LIBCUDACXX_TEMPLATE_VIS insert_iterator37#if _LIBCUDACXX_STD_VER <= 14 || !defined(_LIBCUDACXX_ABI_NO_ITERATOR_BASES)38    : public iterator<output_iterator_tag,39                      void,40                      void,41                      void,42                      void>43#endif44{45_LIBCUDACXX_SUPPRESS_DEPRECATED_POP46protected:47    _Container* container;48    typename _Container::iterator iter;49public:50    typedef _Container container_type;51 52    _LIBCUDACXX_INLINE_VISIBILITY insert_iterator(_Container& __x, typename _Container::iterator __i)53        : container(_CUDA_VSTD::addressof(__x)), iter(__i) {}54    _LIBCUDACXX_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value_)55        {iter = container->insert(iter, __value_); ++iter; return *this;}56    _LIBCUDACXX_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value_)57        {iter = container->insert(iter, _CUDA_VSTD::move(__value_)); ++iter; return *this;}58    _LIBCUDACXX_INLINE_VISIBILITY insert_iterator& operator*()        {return *this;}59    _LIBCUDACXX_INLINE_VISIBILITY insert_iterator& operator++()       {return *this;}60    _LIBCUDACXX_INLINE_VISIBILITY insert_iterator& operator++(int)    {return *this;}61};62 63template <class _Container>64inline _LIBCUDACXX_INLINE_VISIBILITY65insert_iterator<_Container>66inserter(_Container& __x, typename _Container::iterator __i)67{68    return insert_iterator<_Container>(__x, __i);69}70 71_LIBCUDACXX_END_NAMESPACE_STD72 73#endif // _LIBCUDACXX___ITERATOR_INSERT_ITERATOR_H74 
codekingpro/portable-devtools · Team Ai