stlab.adobe.com Adobe Systems Incorporated
set_next.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2005-2007 Adobe Systems Incorporated
3  Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
4  or a copy at http://stlab.adobe.com/licenses.html)
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 
17 namespace adobe {
18 
19 namespace unsafe {
20 
25 /*
26 Example:
27 
28 template <>
29 stuct set_next_fn<T>
30 {
31  void operator()(T x, T y) const
32  {
33  //...
34  }
35 };
36 */
37 
38 template <typename I> // I models NodeIterator
39 struct set_next_fn; // Must be specialized
40 
41 /*************************************************************************************************/
42 
43 template <typename I> // I models NodeIterator
44 inline void set_next(I x, I y)
45 {
46  set_next_fn<I>()(x, y);
47 }
48 
49 /*************************************************************************************************/
50 
51 /*
52  location: a valid forward node iterator
53  first and last - two valid node iterators
54 
55  postcondition: location->first...last->next(location)
56 */
57 
58 template <typename I> // T models ForwardNodeIterator
59 inline void splice_node_range(I location, I first, I last)
60 {
61  I successor(boost::next(location));
62  set_next(location, first);
63  set_next(last, successor);
64 }
65 
66 template <typename I> // I models ForwardNodeIterator
67 inline void skip_next_node(I location)
68 { set_next(location, boost::next(boost::next(location))); }
69 
70 template <typename I> // I models BidirectionalNodeIterator
71 inline void skip_node(I location)
72 { set_next(boost::prior(location), boost::next(location)); }
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:71
void set_next(I x, I y)
Definition: set_next.hpp:44
void splice_node_range(I location, I first, I last)
Definition: set_next.hpp:59
void skip_next_node(I location)
Definition: set_next.hpp:67

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google