Adobe Source Libraries 1.49.0
A collection of C++ libraries.
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 ADOBE_ITERATOR_SET_NEXT_HPP
9#define ADOBE_ITERATOR_SET_NEXT_HPP
10
11#include <adobe/config.hpp>
12
13#include <boost/next_prior.hpp>
14
15/**************************************************************************************************/
16
17namespace adobe {
18
19namespace unsafe {
20
24
25/*
26Example:
27
28template <>
29stuct set_next_fn<T>
30{
31 void operator()(T x, T y) const
32 {
33 //...
34 }
35};
36*/
37
38template <typename I> // I models NodeIterator
39struct set_next_fn; // Must be specialized
40
41/**************************************************************************************************/
42
43template <typename I> // I models NodeIterator
44inline void set_next(I x, I y) {
45 set_next_fn<I>()(x, y);
46}
47
48/**************************************************************************************************/
49
50/*
51 location: a valid forward node iterator
52 first and last - two valid node iterators
53
54 postcondition: location->first...last->next(location)
55*/
56
57template <typename I> // T models ForwardNodeIterator
58inline void splice_node_range(I location, I first, I last) {
59 I successor(boost::next(location));
60 set_next(location, first);
61 set_next(last, successor);
62}
63
64template <typename I> // I models ForwardNodeIterator
65inline void skip_next_node(I location) {
66 set_next(location, boost::next(boost::next(location)));
67}
68
69template <typename I> // I models BidirectionalNodeIterator
70inline void skip_node(I location) {
71 set_next(boost::prior(location), boost::next(location));
72}
73
75
76/**************************************************************************************************/
77
78} // namespace unsafe
79
80} // namespace adobe
81
82/**************************************************************************************************/
83
84// ADOBE_ITERATOR_SET_NEXT_HPP
85#endif
void skip_node(I location)
Definition set_next.hpp:70
void splice_node_range(I location, I first, I last)
Definition set_next.hpp:58
void set_next(I x, I y)
Definition set_next.hpp:44
void skip_next_node(I location)
Definition set_next.hpp:65