stlab
2.4.0
Modern, modular C++ algorithms, data structures, and concurrency primitives
Toggle main menu visibility
Loading...
Searching...
No Matches
set_next.hpp
Go to the documentation of this file.
1
/*
2
Copyright 2013 Adobe
3
Distributed under the Boost Software License, Version 1.0.
4
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
*/
6
/**************************************************************************************************/
7
8
#ifndef STLAB_ITERATOR_SET_NEXT_HPP
9
#define STLAB_ITERATOR_SET_NEXT_HPP
10
14
15
#include <iterator>
16
17
#include <stlab/config.hpp>
18
19
/**************************************************************************************************/
20
21
namespace
stlab
{
22
STLAB_VERSION_NAMESPACE_BEGIN()
23
namespace
unsafe
{
24
30
31
/**************************************************************************************************/
32
34
template
<
typename
I>
// I models NodeIterator
35
struct
set_next_fn
;
// Must be specialized
36
37
/**************************************************************************************************/
38
40
template
<
typename
I>
// I models NodeIterator
41
inline
void
set_next
(
const
I& x,
const
I& y) {
42
set_next_fn<I>
()(x, y);
43
}
44
45
/**************************************************************************************************/
46
47
template
<
typename
I>
// T models ForwardNodeIterator
48
inline
void
splice_node_range(I location, I first, I last) {
49
I successor(std::next(location));
50
set_next(location, first);
51
set_next(last, successor);
52
}
53
55
template
<
typename
I>
// I models ForwardNodeIterator
56
inline
void
skip_next_node
(I location) {
57
set_next
(location, std::next(std::next(location)));
58
}
59
61
template
<
typename
I>
// I models BidirectionalNodeIterator
62
inline
void
skip_node
(I location) {
63
set_next
(std::prev(location), std::next(location));
64
}
65
66
/**************************************************************************************************/
67
69
70
}
// namespace unsafe
71
STLAB_VERSION_NAMESPACE_END()
72
}
// namespace stlab
73
74
/**************************************************************************************************/
75
76
#endif
// STLAB_ITERATOR_SET_NEXT_HPP
77
78
/**************************************************************************************************/
stlab::unsafe::skip_node
void skip_node(I location)
Removes the node at location from the intrusive list (bidirectional iterator).
Definition
set_next.hpp:62
stlab::unsafe::skip_next_node
void skip_next_node(I location)
Skips the node after location by linking location to the node after next.
Definition
set_next.hpp:56
stlab::unsafe::set_next
void set_next(const I &x, const I &y)
Sets the successor of the node referenced by x to y (via set_next_fn<I>).
Definition
set_next.hpp:41
stlab::unsafe
Definition
reverse.hpp:39
stlab
Definition
reverse.hpp:28
stlab::unsafe::set_next_fn
Hook for intrusive iterators: specialize to set the successor of the node at x to y.
Definition
set_next.hpp:35
stlab
iterator
set_next.hpp
Generated by
1.18.0