stlab.adobe.com Adobe Systems Incorporated

set_next.hpp

Go to the documentation of this file.
00001 /*
00002     Copyright 2005-2007 Adobe Systems Incorporated
00003     Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
00004     or a copy at http://stlab.adobe.com/licenses.html)
00005 */
00006 /*************************************************************************************************/
00007 
00008 #ifndef ADOBE_ITERATOR_SET_NEXT_HPP
00009 #define ADOBE_ITERATOR_SET_NEXT_HPP
00010 
00011 #include <adobe/config.hpp>
00012 
00013 #include <boost/next_prior.hpp>
00014 
00015 /*************************************************************************************************/
00016 
00017 namespace adobe {
00018 
00019 namespace unsafe {
00020 
00025 /*
00026 Example:
00027 
00028 template <>
00029 stuct set_next_fn<T>
00030 {
00031     void operator()(T x, T y) const
00032     {
00033     //...
00034     }
00035 };
00036 */
00037 
00038 template <typename I> // I models NodeIterator
00039 struct set_next_fn; // Must be specialized
00040 
00041 /*************************************************************************************************/
00042 
00043 template <typename I> // I models NodeIterator
00044 inline void set_next(I x, I y)
00045 {
00046     set_next_fn<I>()(x, y);
00047 }
00048 
00049 /*************************************************************************************************/
00050 
00051 /*
00052     location: a valid forward node iterator
00053     first and last - two valid node iterators
00054     
00055     postcondition: location->first...last->next(location)
00056 */
00057 
00058 template <typename I> // T models ForwardNodeIterator
00059 inline void splice_node_range(I location, I first, I last)
00060 {
00061     I successor(boost::next(location));
00062     set_next(location, first);
00063     set_next(last, successor);
00064 }
00065 
00066 template <typename I> // I models ForwardNodeIterator
00067 inline void skip_next_node(I location)
00068 { set_next(location, boost::next(boost::next(location))); }
00069 
00070 template <typename I> // I models BidirectionalNodeIterator
00071 inline void skip_node(I location)
00072 { set_next(boost::prior(location), boost::next(location)); }
00073 
00075 
00076 /*************************************************************************************************/
00077 
00078 } // namespace unsafe
00079 
00080 } // namespace adobe
00081 
00082 /*************************************************************************************************/
00083 
00084 // ADOBE_ITERATOR_SET_NEXT_HPP
00085 #endif

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