codekingpro/portable-devtools
115k
1// -*- C++ -*-2#ifndef _LIBCUDACXX_SPLIT_BUFFER3#define _LIBCUDACXX_SPLIT_BUFFER4 5#include <__config>6#include <type_traits>7#include <algorithm>8 9#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)10# pragma GCC system_header11#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)12# pragma clang system_header13#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)14# pragma system_header15#endif // no system header16 17_LIBCUDACXX_PUSH_MACROS18#include <__undef_macros>19 20 21_LIBCUDACXX_BEGIN_NAMESPACE_STD22 23template <bool>24class __split_buffer_common25{26protected:27 void __throw_length_error() const;28 void __throw_out_of_range() const;29};30 31template <class _Tp, class _Allocator = allocator<_Tp> >32struct __split_buffer33 : private __split_buffer_common<true>34{35private:36 __split_buffer(const __split_buffer&);37 __split_buffer& operator=(const __split_buffer&);38public:39 typedef _Tp value_type;40 typedef _Allocator allocator_type;41 typedef __libcpp_remove_reference_t<allocator_type> __alloc_rr;42 typedef allocator_traits<__alloc_rr> __alloc_traits;43 typedef value_type& reference;44 typedef const value_type& const_reference;45 typedef typename __alloc_traits::size_type size_type;46 typedef typename __alloc_traits::difference_type difference_type;47 typedef typename __alloc_traits::pointer pointer;48 typedef typename __alloc_traits::const_pointer const_pointer;49 typedef pointer iterator;50 typedef const_pointer const_iterator;51 52 pointer __first_;53 pointer __begin_;54 pointer __end_;55 __compressed_pair<pointer, allocator_type> __end_cap_;56 57 typedef __add_lvalue_reference_t<allocator_type> __alloc_ref;58 typedef __add_lvalue_reference_t<allocator_type> __alloc_const_ref;59 60 _LIBCUDACXX_INLINE_VISIBILITY __alloc_rr& __alloc() noexcept {return __end_cap_.second();}61 _LIBCUDACXX_INLINE_VISIBILITY const __alloc_rr& __alloc() const noexcept {return __end_cap_.second();}62 _LIBCUDACXX_INLINE_VISIBILITY pointer& __end_cap() noexcept {return __end_cap_.first();}63 _LIBCUDACXX_INLINE_VISIBILITY const pointer& __end_cap() const noexcept {return __end_cap_.first();}64 65 _LIBCUDACXX_INLINE_VISIBILITY66 __split_buffer()67 noexcept(is_nothrow_default_constructible<allocator_type>::value);68 _LIBCUDACXX_INLINE_VISIBILITY69 explicit __split_buffer(__alloc_rr& __a);70 _LIBCUDACXX_INLINE_VISIBILITY71 explicit __split_buffer(const __alloc_rr& __a);72 __split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);73 ~__split_buffer();74 75 __split_buffer(__split_buffer&& __c)76 noexcept(is_nothrow_move_constructible<allocator_type>::value);77 __split_buffer(__split_buffer&& __c, const __alloc_rr& __a);78 __split_buffer& operator=(__split_buffer&& __c)79 noexcept((__alloc_traits::propagate_on_container_move_assignment::value &&80 is_nothrow_move_assignable<allocator_type>::value) ||81 !__alloc_traits::propagate_on_container_move_assignment::value);82 83 _LIBCUDACXX_INLINE_VISIBILITY iterator begin() noexcept {return __begin_;}84 _LIBCUDACXX_INLINE_VISIBILITY const_iterator begin() const noexcept {return __begin_;}85 _LIBCUDACXX_INLINE_VISIBILITY iterator end() noexcept {return __end_;}86 _LIBCUDACXX_INLINE_VISIBILITY const_iterator end() const noexcept {return __end_;}87 88 _LIBCUDACXX_INLINE_VISIBILITY89 void clear() noexcept90 {__destruct_at_end(__begin_);}91 _LIBCUDACXX_INLINE_VISIBILITY size_type size() const {return static_cast<size_type>(__end_ - __begin_);}92 _LIBCUDACXX_INLINE_VISIBILITY bool empty() const {return __end_ == __begin_;}93 _LIBCUDACXX_INLINE_VISIBILITY size_type capacity() const {return static_cast<size_type>(__end_cap() - __first_);}94 _LIBCUDACXX_INLINE_VISIBILITY size_type __front_spare() const {return static_cast<size_type>(__begin_ - __first_);}95 _LIBCUDACXX_INLINE_VISIBILITY size_type __back_spare() const {return static_cast<size_type>(__end_cap() - __end_);}96 97 _LIBCUDACXX_INLINE_VISIBILITY reference front() {return *__begin_;}98 _LIBCUDACXX_INLINE_VISIBILITY const_reference front() const {return *__begin_;}99 _LIBCUDACXX_INLINE_VISIBILITY reference back() {return *(__end_ - 1);}100 _LIBCUDACXX_INLINE_VISIBILITY const_reference back() const {return *(__end_ - 1);}101 102 void reserve(size_type __n);103 void shrink_to_fit() noexcept;104 void push_front(const_reference __x);105 _LIBCUDACXX_INLINE_VISIBILITY void push_back(const_reference __x);106 void push_front(value_type&& __x);107 void push_back(value_type&& __x);108 template <class... _Args>109 void emplace_back(_Args&&... __args);110 111 _LIBCUDACXX_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);}112 _LIBCUDACXX_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}113 114 void __construct_at_end(size_type __n);115 void __construct_at_end(size_type __n, const_reference __x);116 template <class _InputIter>117 typename enable_if118 <119 __is_cpp17_input_iterator<_InputIter>::value &&120 !__is_cpp17_forward_iterator<_InputIter>::value,121 void122 >::type123 __construct_at_end(_InputIter __first, _InputIter __last);124 template <class _ForwardIterator>125 typename enable_if126 <127 __is_cpp17_forward_iterator<_ForwardIterator>::value,128 void129 >::type130 __construct_at_end(_ForwardIterator __first, _ForwardIterator __last);131 132 _LIBCUDACXX_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)133 {__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());}134 _LIBCUDACXX_INLINE_VISIBILITY135 void __destruct_at_begin(pointer __new_begin, false_type);136 _LIBCUDACXX_INLINE_VISIBILITY137 void __destruct_at_begin(pointer __new_begin, true_type);138 139 _LIBCUDACXX_INLINE_VISIBILITY140 void __destruct_at_end(pointer __new_last) noexcept141 {__destruct_at_end(__new_last, false_type());}142 _LIBCUDACXX_INLINE_VISIBILITY143 void __destruct_at_end(pointer __new_last, false_type) noexcept;144 _LIBCUDACXX_INLINE_VISIBILITY145 void __destruct_at_end(pointer __new_last, true_type) noexcept;146 147 void swap(__split_buffer& __x)148 noexcept(!__alloc_traits::propagate_on_container_swap::value||149 __is_nothrow_swappable<__alloc_rr>::value);150 151 bool __invariants() const;152 153private:154 _LIBCUDACXX_INLINE_VISIBILITY155 void __move_assign_alloc(__split_buffer& __c, true_type)156 noexcept(is_nothrow_move_assignable<allocator_type>::value)157 {158 __alloc() = _CUDA_VSTD::move(__c.__alloc());159 }160 161 _LIBCUDACXX_INLINE_VISIBILITY162 void __move_assign_alloc(__split_buffer&, false_type) noexcept163 {}164 165 struct _ConstructTransaction {166 explicit _ConstructTransaction(pointer* __p, size_type __n) noexcept167 : __pos_(*__p), __end_(*__p + __n), __dest_(__p) {168 }169 ~_ConstructTransaction() {170 *__dest_ = __pos_;171 }172 pointer __pos_;173 const pointer __end_;174 private:175 pointer *__dest_;176 };177};178 179template <class _Tp, class _Allocator>180bool181__split_buffer<_Tp, _Allocator>::__invariants() const182{183 if (__first_ == nullptr)184 {185 if (__begin_ != nullptr)186 return false;187 if (__end_ != nullptr)188 return false;189 if (__end_cap() != nullptr)190 return false;191 }192 else193 {194 if (__begin_ < __first_)195 return false;196 if (__end_ < __begin_)197 return false;198 if (__end_cap() < __end_)199 return false;200 }201 return true;202}203 204// Default constructs __n objects starting at __end_205// throws if construction throws206// Precondition: __n > 0207// Precondition: size() + __n <= capacity()208// Postcondition: size() == size() + __n209template <class _Tp, class _Allocator>210void211__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)212{213 _ConstructTransaction __tx(&this->__end_, __n);214 for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {215 __alloc_traits::construct(this->__alloc(), _CUDA_VSTD::__to_raw_pointer(__tx.__pos_));216 }217}218 219// Copy constructs __n objects starting at __end_ from __x220// throws if construction throws221// Precondition: __n > 0222// Precondition: size() + __n <= capacity()223// Postcondition: size() == old size() + __n224// Postcondition: [i] == __x for all i in [size() - __n, __n)225template <class _Tp, class _Allocator>226void227__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)228{229 _ConstructTransaction __tx(&this->__end_, __n);230 for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {231 __alloc_traits::construct(this->__alloc(),232 _CUDA_VSTD::__to_raw_pointer(__tx.__pos_), __x);233 }234}235 236template <class _Tp, class _Allocator>237template <class _InputIter>238typename enable_if239<240 __is_cpp17_input_iterator<_InputIter>::value &&241 !__is_cpp17_forward_iterator<_InputIter>::value,242 void243>::type244__split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last)245{246 __alloc_rr& __a = this->__alloc();247 for (; __first != __last; ++__first)248 {249 if (__end_ == __end_cap())250 {251 size_type __old_cap = __end_cap() - __first_;252 size_type __new_cap = _CUDA_VSTD::max<size_type>(2 * __old_cap, 8);253 __split_buffer __buf(__new_cap, 0, __a);254 for (pointer __p = __begin_; __p != __end_; ++__p, (void)++__buf.__end_)255 __alloc_traits::construct(__buf.__alloc(),256 _CUDA_VSTD::__to_raw_pointer(__buf.__end_), _CUDA_VSTD::move(*__p));257 swap(__buf);258 }259 __alloc_traits::construct(__a, _CUDA_VSTD::__to_raw_pointer(this->__end_), *__first);260 ++this->__end_;261 }262}263 264template <class _Tp, class _Allocator>265template <class _ForwardIterator>266typename enable_if267<268 __is_cpp17_forward_iterator<_ForwardIterator>::value,269 void270>::type271__split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)272{273 _ConstructTransaction __tx(&this->__end_, std::distance(__first, __last));274 for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void)++__first) {275 __alloc_traits::construct(this->__alloc(),276 _CUDA_VSTD::__to_raw_pointer(__tx.__pos_), *__first);277 }278}279 280template <class _Tp, class _Allocator>281inline282void283__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)284{285 while (__begin_ != __new_begin)286 __alloc_traits::destroy(__alloc(), __to_raw_pointer(__begin_++));287}288 289template <class _Tp, class _Allocator>290inline291void292__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type)293{294 __begin_ = __new_begin;295}296 297template <class _Tp, class _Allocator>298inline _LIBCUDACXX_INLINE_VISIBILITY299void300__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) noexcept301{302 while (__new_last != __end_)303 __alloc_traits::destroy(__alloc(), __to_raw_pointer(--__end_));304}305 306template <class _Tp, class _Allocator>307inline _LIBCUDACXX_INLINE_VISIBILITY308void309__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) noexcept310{311 __end_ = __new_last;312}313 314template <class _Tp, class _Allocator>315__split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a)316 : __end_cap_(nullptr, __a)317{318 __first_ = __cap != 0 ? __alloc_traits::allocate(__alloc(), __cap) : nullptr;319 __begin_ = __end_ = __first_ + __start;320 __end_cap() = __first_ + __cap;321}322 323template <class _Tp, class _Allocator>324inline325__split_buffer<_Tp, _Allocator>::__split_buffer()326 noexcept(is_nothrow_default_constructible<allocator_type>::value)327 : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr)328{329}330 331template <class _Tp, class _Allocator>332inline333__split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a)334 : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)335{336}337 338template <class _Tp, class _Allocator>339inline340__split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a)341 : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)342{343}344 345template <class _Tp, class _Allocator>346__split_buffer<_Tp, _Allocator>::~__split_buffer()347{348 clear();349 if (__first_)350 __alloc_traits::deallocate(__alloc(), __first_, capacity());351}352 353template <class _Tp, class _Allocator>354__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)355 noexcept(is_nothrow_move_constructible<allocator_type>::value)356 : __first_(_CUDA_VSTD::move(__c.__first_)),357 __begin_(_CUDA_VSTD::move(__c.__begin_)),358 __end_(_CUDA_VSTD::move(__c.__end_)),359 __end_cap_(_CUDA_VSTD::move(__c.__end_cap_))360{361 __c.__first_ = nullptr;362 __c.__begin_ = nullptr;363 __c.__end_ = nullptr;364 __c.__end_cap() = nullptr;365}366 367template <class _Tp, class _Allocator>368__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)369 : __end_cap_(__second_tag(), __a)370{371 if (__a == __c.__alloc())372 {373 __first_ = __c.__first_;374 __begin_ = __c.__begin_;375 __end_ = __c.__end_;376 __end_cap() = __c.__end_cap();377 __c.__first_ = nullptr;378 __c.__begin_ = nullptr;379 __c.__end_ = nullptr;380 __c.__end_cap() = nullptr;381 }382 else383 {384 size_type __cap = __c.size();385 __first_ = __alloc_traits::allocate(__alloc(), __cap);386 __begin_ = __end_ = __first_;387 __end_cap() = __first_ + __cap;388 typedef move_iterator<iterator> _Ip;389 __construct_at_end(_Ip(__c.begin()), _Ip(__c.end()));390 }391}392 393template <class _Tp, class _Allocator>394__split_buffer<_Tp, _Allocator>&395__split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)396 noexcept((__alloc_traits::propagate_on_container_move_assignment::value &&397 is_nothrow_move_assignable<allocator_type>::value) ||398 !__alloc_traits::propagate_on_container_move_assignment::value)399{400 clear();401 shrink_to_fit();402 __first_ = __c.__first_;403 __begin_ = __c.__begin_;404 __end_ = __c.__end_;405 __end_cap() = __c.__end_cap();406 __move_assign_alloc(__c,407 integral_constant<bool,408 __alloc_traits::propagate_on_container_move_assignment::value>());409 __c.__first_ = __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;410 return *this;411}412 413template <class _Tp, class _Allocator>414void415__split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)416 noexcept(!__alloc_traits::propagate_on_container_swap::value||417 __is_nothrow_swappable<__alloc_rr>::value)418{419 _CUDA_VSTD::swap(__first_, __x.__first_);420 _CUDA_VSTD::swap(__begin_, __x.__begin_);421 _CUDA_VSTD::swap(__end_, __x.__end_);422 _CUDA_VSTD::swap(__end_cap(), __x.__end_cap());423 __swap_allocator(__alloc(), __x.__alloc());424}425 426template <class _Tp, class _Allocator>427void428__split_buffer<_Tp, _Allocator>::reserve(size_type __n)429{430 if (__n < capacity())431 {432 __split_buffer<value_type, __alloc_rr&> __t(__n, 0, __alloc());433 __t.__construct_at_end(move_iterator<pointer>(__begin_),434 move_iterator<pointer>(__end_));435 _CUDA_VSTD::swap(__first_, __t.__first_);436 _CUDA_VSTD::swap(__begin_, __t.__begin_);437 _CUDA_VSTD::swap(__end_, __t.__end_);438 _CUDA_VSTD::swap(__end_cap(), __t.__end_cap());439 }440}441 442template <class _Tp, class _Allocator>443void444__split_buffer<_Tp, _Allocator>::shrink_to_fit() noexcept445{446 if (capacity() > size())447 {448#ifndef _LIBCUDACXX_NO_EXCEPTIONS449 try450 {451#endif // _LIBCUDACXX_NO_EXCEPTIONS452 __split_buffer<value_type, __alloc_rr&> __t(size(), 0, __alloc());453 __t.__construct_at_end(move_iterator<pointer>(__begin_),454 move_iterator<pointer>(__end_));455 __t.__end_ = __t.__begin_ + (__end_ - __begin_);456 _CUDA_VSTD::swap(__first_, __t.__first_);457 _CUDA_VSTD::swap(__begin_, __t.__begin_);458 _CUDA_VSTD::swap(__end_, __t.__end_);459 _CUDA_VSTD::swap(__end_cap(), __t.__end_cap());460#ifndef _LIBCUDACXX_NO_EXCEPTIONS461 }462 catch (...)463 {464 }465#endif // _LIBCUDACXX_NO_EXCEPTIONS466 }467}468 469template <class _Tp, class _Allocator>470void471__split_buffer<_Tp, _Allocator>::push_front(const_reference __x)472{473 if (__begin_ == __first_)474 {475 if (__end_ < __end_cap())476 {477 difference_type __d = __end_cap() - __end_;478 __d = (__d + 1) / 2;479 __begin_ = _CUDA_VSTD::move_backward(__begin_, __end_, __end_ + __d);480 __end_ += __d;481 }482 else483 {484 size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);485 __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());486 __t.__construct_at_end(move_iterator<pointer>(__begin_),487 move_iterator<pointer>(__end_));488 _CUDA_VSTD::swap(__first_, __t.__first_);489 _CUDA_VSTD::swap(__begin_, __t.__begin_);490 _CUDA_VSTD::swap(__end_, __t.__end_);491 _CUDA_VSTD::swap(__end_cap(), __t.__end_cap());492 }493 }494 __alloc_traits::construct(__alloc(), _CUDA_VSTD::__to_raw_pointer(__begin_-1), __x);495 --__begin_;496}497 498template <class _Tp, class _Allocator>499void500__split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)501{502 if (__begin_ == __first_)503 {504 if (__end_ < __end_cap())505 {506 difference_type __d = __end_cap() - __end_;507 __d = (__d + 1) / 2;508 __begin_ = _CUDA_VSTD::move_backward(__begin_, __end_, __end_ + __d);509 __end_ += __d;510 }511 else512 {513 size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);514 __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());515 __t.__construct_at_end(move_iterator<pointer>(__begin_),516 move_iterator<pointer>(__end_));517 _CUDA_VSTD::swap(__first_, __t.__first_);518 _CUDA_VSTD::swap(__begin_, __t.__begin_);519 _CUDA_VSTD::swap(__end_, __t.__end_);520 _CUDA_VSTD::swap(__end_cap(), __t.__end_cap());521 }522 }523 __alloc_traits::construct(__alloc(), _CUDA_VSTD::__to_raw_pointer(__begin_-1),524 _CUDA_VSTD::move(__x));525 --__begin_;526}527 528template <class _Tp, class _Allocator>529inline _LIBCUDACXX_INLINE_VISIBILITY530void531__split_buffer<_Tp, _Allocator>::push_back(const_reference __x)532{533 if (__end_ == __end_cap())534 {535 if (__begin_ > __first_)536 {537 difference_type __d = __begin_ - __first_;538 __d = (__d + 1) / 2;539 __end_ = _CUDA_VSTD::move(__begin_, __end_, __begin_ - __d);540 __begin_ -= __d;541 }542 else543 {544 size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);545 __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());546 __t.__construct_at_end(move_iterator<pointer>(__begin_),547 move_iterator<pointer>(__end_));548 _CUDA_VSTD::swap(__first_, __t.__first_);549 _CUDA_VSTD::swap(__begin_, __t.__begin_);550 _CUDA_VSTD::swap(__end_, __t.__end_);551 _CUDA_VSTD::swap(__end_cap(), __t.__end_cap());552 }553 }554 __alloc_traits::construct(__alloc(), _CUDA_VSTD::__to_raw_pointer(__end_), __x);555 ++__end_;556}557 558template <class _Tp, class _Allocator>559void560__split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)561{562 if (__end_ == __end_cap())563 {564 if (__begin_ > __first_)565 {566 difference_type __d = __begin_ - __first_;567 __d = (__d + 1) / 2;568 __end_ = _CUDA_VSTD::move(__begin_, __end_, __begin_ - __d);569 __begin_ -= __d;570 }571 else572 {573 size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);574 __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());575 __t.__construct_at_end(move_iterator<pointer>(__begin_),576 move_iterator<pointer>(__end_));577 _CUDA_VSTD::swap(__first_, __t.__first_);578 _CUDA_VSTD::swap(__begin_, __t.__begin_);579 _CUDA_VSTD::swap(__end_, __t.__end_);580 _CUDA_VSTD::swap(__end_cap(), __t.__end_cap());581 }582 }583 __alloc_traits::construct(__alloc(), _CUDA_VSTD::__to_raw_pointer(__end_),584 _CUDA_VSTD::move(__x));585 ++__end_;586}587 588template <class _Tp, class _Allocator>589template <class... _Args>590void591__split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)592{593 if (__end_ == __end_cap())594 {595 if (__begin_ > __first_)596 {597 difference_type __d = __begin_ - __first_;598 __d = (__d + 1) / 2;599 __end_ = _CUDA_VSTD::move(__begin_, __end_, __begin_ - __d);600 __begin_ -= __d;601 }602 else603 {604 size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);605 __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());606 __t.__construct_at_end(move_iterator<pointer>(__begin_),607 move_iterator<pointer>(__end_));608 _CUDA_VSTD::swap(__first_, __t.__first_);609 _CUDA_VSTD::swap(__begin_, __t.__begin_);610 _CUDA_VSTD::swap(__end_, __t.__end_);611 _CUDA_VSTD::swap(__end_cap(), __t.__end_cap());612 }613 }614 __alloc_traits::construct(__alloc(), _CUDA_VSTD::__to_raw_pointer(__end_),615 _CUDA_VSTD::forward<_Args>(__args)...);616 ++__end_;617}618 619template <class _Tp, class _Allocator>620inline _LIBCUDACXX_INLINE_VISIBILITY621void622swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)623 noexcept(noexcept(__x.swap(__y)))624{625 __x.swap(__y);626}627 628_LIBCUDACXX_END_NAMESPACE_STD629 630_LIBCUDACXX_POP_MACROS631 632#endif // _LIBCUDACXX_SPLIT_BUFFER633 