stlab 2.3.0
Modern, modular C++ algorithms, data structures, and concurrency primitives
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
21namespace stlab {
22STLAB_VERSION_NAMESPACE_BEGIN()
23namespace unsafe {
24
30
31/**************************************************************************************************/
32
34template <typename I> // I models NodeIterator
35struct set_next_fn; // Must be specialized
36
37/**************************************************************************************************/
38
40template <typename I> // I models NodeIterator
41inline void set_next(const I& x, const I& y) {
42 set_next_fn<I>()(x, y);
43}
44
45/**************************************************************************************************/
46
47template <typename I> // T models ForwardNodeIterator
48inline 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
55template <typename I> // I models ForwardNodeIterator
56inline void skip_next_node(I location) {
57 set_next(location, std::next(std::next(location)));
58}
59
61template <typename I> // I models BidirectionalNodeIterator
62inline void skip_node(I location) {
63 set_next(std::prev(location), std::next(location));
64}
65
66/**************************************************************************************************/
67
69
70} // namespace unsafe
71STLAB_VERSION_NAMESPACE_END()
72} // namespace stlab
73
74/**************************************************************************************************/
75
76#endif // STLAB_ITERATOR_SET_NEXT_HPP
77
78/**************************************************************************************************/
void skip_node(I location)
Removes the node at location from the intrusive list (bidirectional iterator).
Definition set_next.hpp:62
void skip_next_node(I location)
Skips the node after location by linking location to the node after next.
Definition set_next.hpp:56
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
Definition reverse.hpp:39
Definition reverse.hpp:28
Hook for intrusive iterators: specialize to set the successor of the node at x to y.
Definition set_next.hpp:35