11 template <
typename T,
typename =
void>
16 struct is_global_iterator<T, std::void_t<typename T::checkout_iterator>> :
public std::true_type {};
27 template <
typename GPtr,
typename Mode>
28 using checkout_iterator_t =
29 std::conditional_t<std::is_same_v<Mode, checkout_mode::no_access_t>,
31 std::conditional_t<std::is_same_v<Mode, checkout_mode::read_t>,
32 const typename GPtr::value_type*,
33 typename GPtr::value_type*>>;
36 using src_checkout_mode_t = std::conditional_t<std::is_trivially_copyable_v<T>,
41 using dest_checkout_mode_t = std::conditional_t<std::is_trivially_copyable_v<T>,
51 template <
typename T,
typename Mode>
85 return this_t(base_t::operator+(diff));
89 return this_t(base_t::operator-(diff));
93 if constexpr(std::is_same_v<mode, checkout_mode::no_access_t>) {
94 return std::make_tuple(
nullptr,
base_t(*
this));
156 template <
typename T,
typename Mode>
157 inline global_iterator<T, Mode>
166 template <
typename GlobalIterator>
169 using base_t = GlobalIterator;
180 static_assert(std::is_same_v<
mode, internal::src_checkout_mode_t<value_type>>);
186 return static_cast<base_t
>(*this);
190 base_t::operator+=(diff);
195 base_t::operator-=(diff);
206 return this_t(base_t::operator+(diff));
210 return this_t(base_t::operator-(diff));
256 template <
typename T>
257 inline global_move_iterator<global_iterator<T, internal::src_checkout_mode_t<T>>>
266 template <
typename GlobalIterator>
269 using base_t = std::reverse_iterator<GlobalIterator>;
284 return static_cast<base_t
>(*this).base();
288 base_t::operator+=(diff);
293 base_t::operator-=(diff);
304 return this_t(base_t::operator+(diff));
308 return this_t(base_t::operator-(diff));
312 GlobalIterator git =
base();
313 auto&& [cs, it] = std::prev(git, count).checkout_nb(count);
331 template <
typename T,
typename Mode>
332 inline global_reverse_iterator<global_iterator<T, Mode>>
341 template <
typename GlobalIterator>
344 using base_t = GlobalIterator;
346 static_assert(std::is_same_v<typename GlobalIterator::mode, checkout_mode::write_t>);
361 return static_cast<base_t
>(*this);
365 base_t::operator+=(diff);
370 base_t::operator-=(diff);
381 return this_t(base_t::operator+(diff));
385 return this_t(base_t::operator-(diff));
404 template <
typename GlobalIterator>
405 inline global_construct_iterator<GlobalIterator>
424 template <
typename T>
425 inline global_construct_iterator<global_iterator<T, checkout_mode::write_t>>
434 template <
typename GlobalIterator>
437 using base_t = GlobalIterator;
439 static_assert(std::is_same_v<typename GlobalIterator::mode, checkout_mode::read_write_t>);
454 return static_cast<base_t
>(*this);
458 base_t::operator+=(diff);
463 base_t::operator-=(diff);
474 return this_t(base_t::operator+(diff));
478 return this_t(base_t::operator-(diff));
497 template <
typename GlobalIterator>
498 inline global_destruct_iterator<GlobalIterator>
517 template <
typename T>
518 inline global_destruct_iterator<global_iterator<T, checkout_mode::read_write_t>>
535 template <
typename T,
typename Mode>
536 inline global_move_iterator<global_iterator<T, Mode>>
551 template <
typename GlobalIterator>
552 inline global_move_iterator<global_reverse_iterator<GlobalIterator>>
567 template <
typename T,
typename Mode>
568 inline global_reverse_iterator<global_iterator<T, Mode>>
583 template <
typename GlobalIterator>
584 inline global_reverse_iterator<global_move_iterator<GlobalIterator>>
590 static_assert(
is_global_iterator_v<global_move_iterator<global_iterator<int, checkout_mode::read_t>>>);
591 static_assert(
is_global_iterator_v<global_reverse_iterator<global_iterator<int, checkout_mode::read_write_t>>>);
592 static_assert(
is_global_iterator_v<global_move_iterator<global_reverse_iterator<global_iterator<int, checkout_mode::read_t>>>>);
593 static_assert(!is_global_iterator_v<int>);
Checkout span to automatically manage the lifetime of checked-out memory.
Definition: checkout_span.hpp:66
constexpr pointer data() const noexcept
Definition: checkout_span.hpp:110
void checkout_nb(ori::global_ptr< T > gptr, std::size_t n, Mode)
Manually perform the nonblocking checkout operation by checking in the previous span.
Definition: checkout_span.hpp:144
Count iterator.
Definition: count_iterator.hpp:33
Global iterator for constructing objects.
Definition: global_iterator.hpp:342
typename base_t::iterator_category iterator_category
Definition: global_iterator.hpp:353
typename base_t::value_type value_type
Definition: global_iterator.hpp:349
typename GlobalIterator::mode mode
Definition: global_iterator.hpp:354
constexpr this_t & operator+=(difference_type diff) noexcept
Definition: global_iterator.hpp:364
constexpr this_t & operator-=(difference_type diff) noexcept
Definition: global_iterator.hpp:369
constexpr this_t & operator++() noexcept
Definition: global_iterator.hpp:374
typename base_t::reference reference
Definition: global_iterator.hpp:352
GlobalIterator base() const
Definition: global_iterator.hpp:360
constexpr this_t operator-(difference_type diff) const noexcept
Definition: global_iterator.hpp:384
constexpr this_t operator+(difference_type diff) const noexcept
Definition: global_iterator.hpp:380
typename base_t::difference_type difference_type
Definition: global_iterator.hpp:350
global_construct_iterator(GlobalIterator git)
Definition: global_iterator.hpp:357
constexpr this_t operator++(int) noexcept
Definition: global_iterator.hpp:377
auto checkout_nb(std::size_t count) const
Definition: global_iterator.hpp:388
constexpr this_t operator--(int) noexcept
Definition: global_iterator.hpp:378
constexpr this_t & operator--() noexcept
Definition: global_iterator.hpp:375
typename base_t::pointer pointer
Definition: global_iterator.hpp:351
Global iterator for destructing objects.
Definition: global_iterator.hpp:435
constexpr this_t operator-(difference_type diff) const noexcept
Definition: global_iterator.hpp:477
typename GlobalIterator::mode mode
Definition: global_iterator.hpp:447
constexpr this_t operator--(int) noexcept
Definition: global_iterator.hpp:471
global_destruct_iterator(GlobalIterator git)
Definition: global_iterator.hpp:450
typename base_t::value_type value_type
Definition: global_iterator.hpp:442
constexpr this_t & operator++() noexcept
Definition: global_iterator.hpp:467
typename base_t::difference_type difference_type
Definition: global_iterator.hpp:443
typename base_t::pointer pointer
Definition: global_iterator.hpp:444
constexpr this_t & operator--() noexcept
Definition: global_iterator.hpp:468
constexpr this_t & operator-=(difference_type diff) noexcept
Definition: global_iterator.hpp:462
auto checkout_nb(std::size_t count) const
Definition: global_iterator.hpp:481
typename base_t::iterator_category iterator_category
Definition: global_iterator.hpp:446
constexpr this_t & operator+=(difference_type diff) noexcept
Definition: global_iterator.hpp:457
constexpr this_t operator+(difference_type diff) const noexcept
Definition: global_iterator.hpp:473
GlobalIterator base() const
Definition: global_iterator.hpp:453
typename base_t::reference reference
Definition: global_iterator.hpp:445
constexpr this_t operator++(int) noexcept
Definition: global_iterator.hpp:470
Global iterator to enable/disable automatic checkout.
Definition: global_iterator.hpp:52
Mode mode
Definition: global_iterator.hpp:62
constexpr this_t operator++(int) noexcept
Definition: global_iterator.hpp:81
constexpr this_t operator--(int) noexcept
Definition: global_iterator.hpp:82
global_iterator(ori::global_ptr< T > gptr)
Definition: global_iterator.hpp:66
constexpr this_t & operator++() noexcept
Definition: global_iterator.hpp:78
constexpr this_t operator+(difference_type diff) const noexcept
Definition: global_iterator.hpp:84
constexpr this_t & operator+=(difference_type diff) noexcept
Definition: global_iterator.hpp:68
constexpr this_t operator-(difference_type diff) const noexcept
Definition: global_iterator.hpp:88
global_iterator()
Definition: global_iterator.hpp:65
auto checkout_nb(std::size_t count) const
Definition: global_iterator.hpp:92
internal::checkout_iterator_t< base_t, Mode > checkout_iterator
Definition: global_iterator.hpp:63
constexpr this_t & operator-=(difference_type diff) noexcept
Definition: global_iterator.hpp:73
constexpr this_t & operator--() noexcept
Definition: global_iterator.hpp:79
Global iterator for moving objects.
Definition: global_iterator.hpp:167
constexpr this_t operator--(int) noexcept
Definition: global_iterator.hpp:203
typename base_t::difference_type difference_type
Definition: global_iterator.hpp:173
typename base_t::iterator_category iterator_category
Definition: global_iterator.hpp:176
typename base_t::pointer pointer
Definition: global_iterator.hpp:174
typename base_t::value_type value_type
Definition: global_iterator.hpp:172
std::move_iterator< typename GlobalIterator::checkout_iterator > checkout_iterator
Definition: global_iterator.hpp:178
constexpr this_t & operator++() noexcept
Definition: global_iterator.hpp:199
constexpr this_t & operator-=(difference_type diff) noexcept
Definition: global_iterator.hpp:194
global_move_iterator(GlobalIterator git)
Definition: global_iterator.hpp:182
typename base_t::reference reference
Definition: global_iterator.hpp:175
constexpr this_t & operator+=(difference_type diff) noexcept
Definition: global_iterator.hpp:189
constexpr this_t operator-(difference_type diff) const noexcept
Definition: global_iterator.hpp:209
GlobalIterator base() const
Definition: global_iterator.hpp:185
auto checkout_nb(std::size_t count) const
Definition: global_iterator.hpp:213
constexpr this_t & operator--() noexcept
Definition: global_iterator.hpp:200
constexpr this_t operator+(difference_type diff) const noexcept
Definition: global_iterator.hpp:205
constexpr this_t operator++(int) noexcept
Definition: global_iterator.hpp:202
typename GlobalIterator::mode mode
Definition: global_iterator.hpp:177
Reverse iterator for global memory.
Definition: global_iterator.hpp:267
typename GlobalIterator::mode mode
Definition: global_iterator.hpp:277
constexpr this_t operator-(difference_type diff) const noexcept
Definition: global_iterator.hpp:307
constexpr this_t & operator--() noexcept
Definition: global_iterator.hpp:298
typename base_t::value_type value_type
Definition: global_iterator.hpp:272
constexpr this_t & operator-=(difference_type diff) noexcept
Definition: global_iterator.hpp:292
auto checkout_nb(std::size_t count) const
Definition: global_iterator.hpp:311
typename base_t::iterator_category iterator_category
Definition: global_iterator.hpp:276
constexpr this_t & operator+=(difference_type diff) noexcept
Definition: global_iterator.hpp:287
typename base_t::pointer pointer
Definition: global_iterator.hpp:274
typename base_t::reference reference
Definition: global_iterator.hpp:275
GlobalIterator base() const
Definition: global_iterator.hpp:283
constexpr this_t operator--(int) noexcept
Definition: global_iterator.hpp:301
constexpr this_t & operator++() noexcept
Definition: global_iterator.hpp:297
global_reverse_iterator(GlobalIterator git)
Definition: global_iterator.hpp:280
typename base_t::difference_type difference_type
Definition: global_iterator.hpp:273
std::reverse_iterator< typename GlobalIterator::checkout_iterator > checkout_iterator
Definition: global_iterator.hpp:278
constexpr this_t operator++(int) noexcept
Definition: global_iterator.hpp:300
constexpr this_t operator+(difference_type diff) const noexcept
Definition: global_iterator.hpp:303
Definition: global_ptr.hpp:19
std::ptrdiff_t difference_type
Definition: global_ptr.hpp:25
std::remove_cv_t< T > value_type
Definition: global_ptr.hpp:24
std::random_access_iterator_tag iterator_category
Definition: global_ptr.hpp:28
T * pointer
Definition: global_ptr.hpp:26
global_ref< T > reference
Definition: global_ptr.hpp:27
constexpr this_t & operator+=(difference_type diff) noexcept
Definition: global_ptr.hpp:51
constexpr this_t & operator-=(difference_type diff) noexcept
Definition: global_ptr.hpp:56
Definition: global_ptr.hpp:173
constexpr read_write_t read_write
Read+Write checkout mode.
Definition: checkout_span.hpp:39
ori::mode::read_t read_t
See ityr::checkout_mode::read.
Definition: checkout_span.hpp:12
ori::mode::write_t write_t
See ityr::checkout_mode::write.
Definition: checkout_span.hpp:22
constexpr write_t write
Write-only checkout mode.
Definition: checkout_span.hpp:29
ITYR_CONCAT(mode_, ITYR_PROFILER_MODE) mode
Definition: profiler.hpp:257
std::pair< T *, bool > checkout_nb(global_ptr< T > ptr, std::size_t count, mode::read_t)
Definition: ori.hpp:108
Definition: allocator.hpp:16
global_reverse_iterator< global_iterator< T, Mode > > make_reverse_iterator(ori::global_ptr< T > gptr, Mode mode)
Make a reverse iterator for global memory.
Definition: global_iterator.hpp:333
global_destruct_iterator< GlobalIterator > make_destruct_iterator(GlobalIterator git)
Make a global iterator for destructing objects.
Definition: global_iterator.hpp:499
global_construct_iterator< GlobalIterator > make_construct_iterator(GlobalIterator git)
Make a global iterator for constructing objects.
Definition: global_iterator.hpp:406
constexpr bool is_global_iterator_v
True if T is a global iterator (ityr::global_iterator).
Definition: global_iterator.hpp:23
global_move_iterator< global_reverse_iterator< GlobalIterator > > make_move_iterator(global_reverse_iterator< GlobalIterator > git)
Make a global iterator for moving objects.
Definition: global_iterator.hpp:553
global_iterator< T, Mode > make_global_iterator(ori::global_ptr< T > gptr, Mode)
Make a global iterator to enable/disable automatic checkout.
Definition: global_iterator.hpp:158
global_move_iterator< global_iterator< T, internal::src_checkout_mode_t< T > > > make_move_iterator(ori::global_ptr< T > gptr)
Make a global iterator for moving objects.
Definition: global_iterator.hpp:258
auto make_count_iterator(T x)
Definition: count_iterator.hpp:98
global_reverse_iterator< global_move_iterator< GlobalIterator > > make_reverse_iterator(global_move_iterator< GlobalIterator > git)
Make a reverse iterator for global memory.
Definition: global_iterator.hpp:585
ForwardIteratorD move(const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIteratorD first_d)
Move a range to another.
Definition: parallel_loop.hpp:934
See ityr::is_global_iterator_v.
Definition: global_iterator.hpp:12