toctave

t(iny)octave
git clone https://0xff.ir/g/toctave.git
Log | Files | Refs | README

set_next.hpp (2122B)


      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 
     11 /*************************************************************************************************/
     12 
     13 namespace stlab {
     14 
     15 /*************************************************************************************************/
     16 
     17 namespace unsafe {
     18 
     19 /*************************************************************************************************/
     20 
     21 template <typename I> // I models NodeIterator
     22 struct set_next_fn;   // Must be specialized
     23 
     24 /*************************************************************************************************/
     25 
     26 template <typename I> // I models NodeIterator
     27 inline void set_next(I x, I y) {
     28     set_next_fn<I>()(x, y);
     29 }
     30 
     31 /*************************************************************************************************/
     32 
     33 template <typename I> // T models ForwardNodeIterator
     34 inline void splice_node_range(I location, I first, I last) {
     35     I successor(std::next(location));
     36     set_next(location, first);
     37     set_next(last, successor);
     38 }
     39 
     40 template <typename I> // I models ForwardNodeIterator
     41 inline void skip_next_node(I location) {
     42     set_next(location, std::next(std::next(location)));
     43 }
     44 
     45 template <typename I> // I models BidirectionalNodeIterator
     46 inline void skip_node(I location) {
     47     set_next(std::prev(location), std::next(location));
     48 }
     49 
     50 /*************************************************************************************************/
     51 
     52 } // namespace unsafe
     53 
     54 /*************************************************************************************************/
     55 
     56 } // namespace stlab
     57 
     58 /*************************************************************************************************/
     59 
     60 #endif // STLAB_ITERATOR_SET_NEXT_HPP
     61 
     62 /*************************************************************************************************/