亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ropeimpl.h

?? TSP問題的一個類庫 有源代碼和stl
?? H
?? 第 1 頁 / 共 4 頁
字號:
/*
 * Copyright (c) 1997
 * Silicon Graphics Computer Systems, Inc.
 *
 * Permission to use, copy, modify, distribute and sell this software
 * and its documentation for any purpose is hereby granted without fee,
 * provided that the above copyright notice appear in all copies and
 * that both that copyright notice and this permission notice appear
 * in supporting documentation.  Silicon Graphics makes no
 * representations about the suitability of this software for any
 * purpose.  It is provided "as is" without express or implied warranty.
 */

/* NOTE: This is an internal header file, included by other STL headers.
 *   You should not attempt to use it directly.
 */

# include <stdio.h>     

#ifdef __STL_USE_NEW_IOSTREAMS 
# include <iostream>
#else /* __STL_USE_NEW_IOSTREAMS */
# include <iostream.h>
#endif /* __STL_USE_NEW_IOSTREAMS */

#ifdef __STL_USE_EXCEPTIONS
# include <stdexcept>
#endif

__STL_BEGIN_NAMESPACE

#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma set woff 1174
#endif

// Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf
// if necessary.  Assumes _M_path_end[leaf_index] and leaf_pos are correct.
// Results in a valid buf_ptr if the iterator can be legitimately
// dereferenced.
template <class _CharT, class _Alloc>
void _Rope_iterator_base<_CharT,_Alloc>::_S_setbuf( 
  _Rope_iterator_base<_CharT,_Alloc>& __x)
{
    const _RopeRep* __leaf = __x._M_path_end[__x._M_leaf_index];
    size_t __leaf_pos = __x._M_leaf_pos;
    size_t __pos = __x._M_current_pos;

    switch(__leaf->_M_tag) {
	case _RopeRep::_S_leaf:
	    __x._M_buf_start = 
	      ((_Rope_RopeLeaf<_CharT,_Alloc>*)__leaf)->_M_data;
	    __x._M_buf_ptr = __x._M_buf_start + (__pos - __leaf_pos);
	    __x._M_buf_end = __x._M_buf_start + __leaf->_M_size;
	    break;
	case _RopeRep::_S_function:
	case _RopeRep::_S_substringfn:
	    {
		size_t __len = _S_iterator_buf_len;
		size_t __buf_start_pos = __leaf_pos;
		size_t __leaf_end = __leaf_pos + __leaf->_M_size;
		char_producer<_CharT>* __fn =
			((_Rope_RopeFunction<_CharT,_Alloc>*)__leaf)->_M_fn;

		if (__buf_start_pos + __len <= __pos) {
		    __buf_start_pos = __pos - __len/4;
		    if (__buf_start_pos + __len > __leaf_end) {
			__buf_start_pos = __leaf_end - __len;
		    }
		}
		if (__buf_start_pos + __len > __leaf_end) {
		    __len = __leaf_end - __buf_start_pos;
		}
		(*__fn)(__buf_start_pos - __leaf_pos, __len, __x._M_tmp_buf);
		__x._M_buf_ptr = __x._M_tmp_buf + (__pos - __buf_start_pos);
		__x._M_buf_start = __x._M_tmp_buf;
		__x._M_buf_end = __x._M_tmp_buf + __len;
	    }
	    break;
	default:
	    __stl_assert(0);
    }
}

// Set path and buffer inside a rope iterator.  We assume that 
// pos and root are already set.
template <class _CharT, class _Alloc>
void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache
(_Rope_iterator_base<_CharT,_Alloc>& __x)
{
    const _RopeRep* __path[_RopeRep::_S_max_rope_depth+1];
    const _RopeRep* __curr_rope;
    int __curr_depth = -1;  /* index into path    */
    size_t __curr_start_pos = 0;
    size_t __pos = __x._M_current_pos;
    unsigned char __dirns = 0; // Bit vector marking right turns in the path

    __stl_assert(__pos <= __x._M_root->_M_size);
    if (__pos >= __x._M_root->_M_size) {
	__x._M_buf_ptr = 0;
	return;
    }
    __curr_rope = __x._M_root;
    if (0 != __curr_rope->_M_c_string) {
	/* Treat the root as a leaf. */
	__x._M_buf_start = __curr_rope->_M_c_string;
	__x._M_buf_end = __curr_rope->_M_c_string + __curr_rope->_M_size;
	__x._M_buf_ptr = __curr_rope->_M_c_string + __pos;
	__x._M_path_end[0] = __curr_rope;
	__x._M_leaf_index = 0;
	__x._M_leaf_pos = 0;
	return;
    }
    for(;;) {
	++__curr_depth;
	__stl_assert(__curr_depth <= _RopeRep::_S_max_rope_depth);
	__path[__curr_depth] = __curr_rope;
	switch(__curr_rope->_M_tag) {
	  case _RopeRep::_S_leaf:
	  case _RopeRep::_S_function:
	  case _RopeRep::_S_substringfn:
	    __x._M_leaf_pos = __curr_start_pos;
	    goto done;
	  case _RopeRep::_S_concat:
	    {
		_Rope_RopeConcatenation<_CharT,_Alloc>* __c =
			(_Rope_RopeConcatenation<_CharT,_Alloc>*)__curr_rope;
		_RopeRep* __left = __c->_M_left;
		size_t __left_len = __left->_M_size;
		
		__dirns <<= 1;
		if (__pos >= __curr_start_pos + __left_len) {
		    __dirns |= 1;
		    __curr_rope = __c->_M_right;
		    __curr_start_pos += __left_len;
		} else {
		    __curr_rope = __left;
		}
	    }
	    break;
	}
    }
  done:
    // Copy last section of path into _M_path_end.
      {
	int __i = -1;
	int __j = __curr_depth + 1 - _S_path_cache_len;

	if (__j < 0) __j = 0;
	while (__j <= __curr_depth) {
	    __x._M_path_end[++__i] = __path[__j++];
	}
	__x._M_leaf_index = __i;
      }
      __x._M_path_directions = __dirns;
      _S_setbuf(__x);
}

// Specialized version of the above.  Assumes that
// the path cache is valid for the previous position.
template <class _CharT, class _Alloc>
void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache_for_incr
(_Rope_iterator_base<_CharT,_Alloc>& __x)
{
    int __current_index = __x._M_leaf_index;
    const _RopeRep* __current_node = __x._M_path_end[__current_index];
    size_t __len = __current_node->_M_size;
    size_t __node_start_pos = __x._M_leaf_pos;
    unsigned char __dirns = __x._M_path_directions;
    _Rope_RopeConcatenation<_CharT,_Alloc>* __c;

    __stl_assert(__x._M_current_pos <= __x._M_root->_M_size);
    if (__x._M_current_pos - __node_start_pos < __len) {
	/* More stuff in this leaf, we just didn't cache it. */
	_S_setbuf(__x);
	return;
    }
    __stl_assert(__node_start_pos + __len == __x._M_current_pos);
    //  node_start_pos is starting position of last_node.
    while (--__current_index >= 0) {
	if (!(__dirns & 1) /* Path turned left */) 
	  break;
	__current_node = __x._M_path_end[__current_index];
	__c = (_Rope_RopeConcatenation<_CharT,_Alloc>*)__current_node;
	// Otherwise we were in the right child.  Thus we should pop
	// the concatenation node.
	__node_start_pos -= __c->_M_left->_M_size;
	__dirns >>= 1;
    }
    if (__current_index < 0) {
	// We underflowed the cache. Punt.
	_S_setcache(__x);
	return;
    }
    __current_node = __x._M_path_end[__current_index];
    __c = (_Rope_RopeConcatenation<_CharT,_Alloc>*)__current_node;
    // current_node is a concatenation node.  We are positioned on the first
    // character in its right child.
    // node_start_pos is starting position of current_node.
    __node_start_pos += __c->_M_left->_M_size;
    __current_node = __c->_M_right;
    __x._M_path_end[++__current_index] = __current_node;
    __dirns |= 1;
    while (_RopeRep::_S_concat == __current_node->_M_tag) {
	++__current_index;
	if (_S_path_cache_len == __current_index) {
	    int __i;
	    for (__i = 0; __i < _S_path_cache_len-1; __i++) {
		__x._M_path_end[__i] = __x._M_path_end[__i+1];
	    }
	    --__current_index;
	}
	__current_node =
	    ((_Rope_RopeConcatenation<_CharT,_Alloc>*)__current_node)->_M_left;
	__x._M_path_end[__current_index] = __current_node;
	__dirns <<= 1;
	// node_start_pos is unchanged.
    }
    __x._M_leaf_index = __current_index;
    __x._M_leaf_pos = __node_start_pos;
    __x._M_path_directions = __dirns;
    _S_setbuf(__x);
}

template <class _CharT, class _Alloc>
void _Rope_iterator_base<_CharT,_Alloc>::_M_incr(size_t __n) {
    _M_current_pos += __n;
    if (0 != _M_buf_ptr) {
        size_t __chars_left = _M_buf_end - _M_buf_ptr;
        if (__chars_left > __n) {
            _M_buf_ptr += __n;
        } else if (__chars_left == __n) {
            _M_buf_ptr += __n;
            _S_setcache_for_incr(*this);
        } else {
            _M_buf_ptr = 0;
        }
    }
}

template <class _CharT, class _Alloc>
void _Rope_iterator_base<_CharT,_Alloc>::_M_decr(size_t __n) {
    if (0 != _M_buf_ptr) {
        size_t __chars_left = _M_buf_ptr - _M_buf_start;
        if (__chars_left >= __n) {
            _M_buf_ptr -= __n;
        } else {
            _M_buf_ptr = 0;
        }
    }
    _M_current_pos -= __n;
}

template <class _CharT, class _Alloc>
void _Rope_iterator<_CharT,_Alloc>::_M_check() {
    if (_M_root_rope->_M_tree_ptr != _M_root) {
        // _Rope was modified.  Get things fixed up.
        _RopeRep::_S_unref(_M_root);
        _M_root = _M_root_rope->_M_tree_ptr;
        _RopeRep::_S_ref(_M_root);
        _M_buf_ptr = 0;
    }
}

template <class _CharT, class _Alloc>
inline 
_Rope_const_iterator<_CharT, _Alloc>::_Rope_const_iterator(
  const _Rope_iterator<_CharT,_Alloc>& __x)
: _Rope_iterator_base<_CharT,_Alloc>(__x) 
{ }

template <class _CharT, class _Alloc>
inline _Rope_iterator<_CharT,_Alloc>::_Rope_iterator(
  rope<_CharT,_Alloc>& __r, size_t __pos)
: _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos), 
  _M_root_rope(&__r)
{
    _RopeRep::_S_ref(_M_root);
}

template <class _CharT, class _Alloc>
inline size_t 
rope<_CharT,_Alloc>::_S_char_ptr_len(const _CharT* __s)
{
    const _CharT* __p = __s;

    while (!_S_is0(*__p)) { ++__p; }
    return (__p - __s);
}


#ifndef __GC

template <class _CharT, class _Alloc>
inline void _Rope_RopeRep<_CharT,_Alloc>::_M_free_c_string()
{
    _CharT* __cstr = _M_c_string;
    if (0 != __cstr) {
	size_t __size = _M_size + 1;
	destroy(__cstr, __cstr + __size);
	_Data_deallocate(__cstr, __size);
    }
}


template <class _CharT, class _Alloc>
#ifdef __STL_USE_STD_ALLOCATORS
  inline void _Rope_RopeRep<_CharT,_Alloc>::_S_free_string(_CharT* __s,
							   size_t __n,
						           allocator_type __a)
#else
  inline void _Rope_RopeRep<_CharT,_Alloc>::_S_free_string(_CharT* __s,
							   size_t __n)
#endif
{
    if (!_S_is_basic_char_type((_CharT*)0)) {
	destroy(__s, __s + __n);
    }
//  This has to be a static member, so this gets a bit messy
#   ifdef __STL_USE_STD_ALLOCATORS
        __a.deallocate(
	    __s, _Rope_RopeLeaf<_CharT,_Alloc>::_S_rounded_up_size(__n));
#   else
	_Data_deallocate(
	    __s, _Rope_RopeLeaf<_CharT,_Alloc>::_S_rounded_up_size(__n));
#   endif
}


//  There are several reasons for not doing this with virtual destructors
//  and a class specific delete operator:
//  - A class specific delete operator can't easily get access to
//    allocator instances if we need them.
//  - Any virtual function would need a 4 or byte vtable pointer;
//    this only requires a one byte tag per object.
template <class _CharT, class _Alloc>
void _Rope_RopeRep<_CharT,_Alloc>::_M_free_tree()
{
    switch(_M_tag) {
	case _S_leaf:
	    {
	        _Rope_RopeLeaf<_CharT,_Alloc>* __l
			= (_Rope_RopeLeaf<_CharT,_Alloc>*)this;
	        __l->_Rope_RopeLeaf<_CharT,_Alloc>::~_Rope_RopeLeaf();
	        _L_deallocate(__l, 1);
	        break;
	    }
	case _S_concat:
	    {
	        _Rope_RopeConcatenation<_CharT,_Alloc>* __c
		    = (_Rope_RopeConcatenation<_CharT,_Alloc>*)this;
	        __c->_Rope_RopeConcatenation<_CharT,_Alloc>::
		       ~_Rope_RopeConcatenation();
	        _C_deallocate(__c, 1);
	        break;
	    }
	case _S_function:
	    {
	        _Rope_RopeFunction<_CharT,_Alloc>* __f
		    = (_Rope_RopeFunction<_CharT,_Alloc>*)this;
	        __f->_Rope_RopeFunction<_CharT,_Alloc>::~_Rope_RopeFunction();
	        _F_deallocate(__f, 1);
	        break;
	    }
	case _S_substringfn:
	    {
	        _Rope_RopeSubstring<_CharT,_Alloc>* __ss =
			(_Rope_RopeSubstring<_CharT,_Alloc>*)this;
		__ss->_Rope_RopeSubstring<_CharT,_Alloc>::
		        ~_Rope_RopeSubstring();
		_S_deallocate(__ss, 1);
		break;
	    }
    }
}
#else

template <class _CharT, class _Alloc>
#ifdef __STL_USE_STD_ALLOCATORS
  inline void _Rope_RopeRep<_CharT,_Alloc>::_S_free_string
		(const _CharT*, size_t, allocator_type)
#else
  inline void _Rope_RopeRep<_CharT,_Alloc>::_S_free_string
		(const _CharT*, size_t)
#endif
{}

#endif


// Concatenate a C string onto a leaf rope by copying the rope data.
// Used for short ropes.
template <class _CharT, class _Alloc>
rope<_CharT,_Alloc>::_RopeLeaf*
rope<_CharT,_Alloc>::_S_leaf_concat_char_iter
		(_RopeLeaf* __r, const _CharT* __iter, size_t __len)
{
    size_t __old_len = __r->_M_size;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩中文字幕一区| 成人一区二区三区视频| 欧美精品电影在线播放| 亚洲成人综合视频| 欧美精品电影在线播放| 国内欧美视频一区二区 | 一本色道久久综合亚洲91| 自拍偷拍国产精品| 欧美自拍丝袜亚洲| 日本系列欧美系列| 国产亚洲一区二区三区| 高清在线成人网| 亚洲精品日韩综合观看成人91| 欧美在线高清视频| 日欧美一区二区| 久久久精品日韩欧美| 成人午夜在线播放| 一区二区三区国产豹纹内裤在线| 欧日韩精品视频| 久久99精品久久只有精品| 中文字幕不卡三区| 91国产视频在线观看| 日本不卡一二三区黄网| 欧美激情一区在线观看| 欧美性猛交一区二区三区精品| 久久精品国产亚洲高清剧情介绍| 国产精品青草久久| 欧美日韩国产精品成人| 精品午夜久久福利影院| 中文字幕日本不卡| 欧美一级日韩不卡播放免费| 床上的激情91.| 婷婷成人综合网| 中文字幕亚洲一区二区va在线| 91麻豆精品国产91久久久久久 | 欧美一区二区啪啪| 成人午夜av电影| 视频在线观看91| 国产精品欧美经典| 日韩一区二区高清| 色先锋aa成人| 成人免费福利片| 久久福利视频一区二区| 亚洲愉拍自拍另类高清精品| 国产精品乱码人人做人人爱| 日韩精品一区在线观看| 欧美色欧美亚洲另类二区| av在线播放成人| 国产精品一区二区在线看| 免费人成精品欧美精品| 一区二区三区四区在线免费观看 | 国产一区三区三区| 天堂成人免费av电影一区| 综合电影一区二区三区| 欧美激情中文不卡| 久久婷婷一区二区三区| 日韩欧美美女一区二区三区| 在线观看视频一区| 色播五月激情综合网| 国产91在线|亚洲| 国产精品一区免费在线观看| 精品一区二区三区日韩| 麻豆成人在线观看| 天天综合网 天天综合色| 一区二区三区精品在线| 亚洲色欲色欲www在线观看| 国产精品色在线| 国产精品色呦呦| 中文字幕在线一区二区三区| 国产日韩在线不卡| 欧美激情在线观看视频免费| 国产女人aaa级久久久级| 久久久精品中文字幕麻豆发布| 26uuu国产日韩综合| 亚洲精品一区二区精华| 久久久av毛片精品| 久久久99免费| 中文字幕欧美一| 一区二区三区资源| 亚洲影院理伦片| 午夜久久久久久久久| 五月婷婷综合在线| 蜜桃av一区二区| 国产一区日韩二区欧美三区| 福利一区在线观看| 92精品国产成人观看免费| av中文字幕不卡| 色播五月激情综合网| 欧美日韩一区三区| 欧美一区二区高清| 久久精品网站免费观看| 中文字幕亚洲视频| 亚洲国产一区二区在线播放| 日韩—二三区免费观看av| 美国三级日本三级久久99| 精品一区二区三区在线观看国产| 国产成a人亚洲| 91首页免费视频| 欧美人成免费网站| 欧美精品一区二区在线播放| 中文字幕 久热精品 视频在线| 亚洲日本在线看| 日韩国产高清影视| 高清成人在线观看| 欧洲一区在线观看| 久久亚洲春色中文字幕久久久| 国产精品无人区| 天堂成人国产精品一区| 东方aⅴ免费观看久久av| 欧美优质美女网站| 精品国产青草久久久久福利| 亚洲日本在线看| 美女视频免费一区| 成人美女视频在线看| 欧美日韩精品系列| 久久精品无码一区二区三区| 一区二区成人在线| 国产麻豆视频一区| 欧美三级日韩在线| 欧美国产日韩a欧美在线观看| 亚洲国产视频直播| 成人小视频在线观看| 91精品国产综合久久久蜜臀粉嫩 | 欧美三级蜜桃2在线观看| 欧美日韩亚洲不卡| 国产精品美女久久久久久久久 | 偷拍一区二区三区四区| 国产很黄免费观看久久| 欧美日韩亚洲国产综合| 亚洲欧洲日产国码二区| 久久福利资源站| 欧美三级韩国三级日本一级| 国产欧美一区二区三区网站| 日本一道高清亚洲日美韩| eeuss国产一区二区三区| 精品国产成人系列| 日韩av不卡在线观看| 99久久精品久久久久久清纯| 久久综合成人精品亚洲另类欧美| 午夜精品福利久久久| 91亚洲精品乱码久久久久久蜜桃| 91在线视频在线| 91精品国产欧美一区二区| 亚洲欧美成aⅴ人在线观看| 国产成人日日夜夜| 日韩一区二区三区高清免费看看| 一个色在线综合| 成人av免费在线| 国产亚洲精品免费| 精品中文字幕一区二区小辣椒| 欧美电影一区二区| 亚洲一区二区三区四区五区黄| 99久久综合色| 中文字幕日韩一区| 成人黄色电影在线| 国产精品私房写真福利视频| 国产成人在线视频网站| 26uuu国产电影一区二区| 久久99精品国产| 欧美成人猛片aaaaaaa| 日本亚洲最大的色成网站www| 777奇米成人网| 五月天网站亚洲| 欧美日韩国产精品自在自线| 五月天一区二区| 日韩视频在线观看一区二区| 日本欧美一区二区三区| 337p亚洲精品色噜噜狠狠| 亚洲成a人v欧美综合天堂| 欧美三级三级三级爽爽爽| 五月天视频一区| 91精品免费在线观看| 欧美aa在线视频| 欧美va天堂va视频va在线| 国产一区二区三区四区在线观看| 欧美精品一区在线观看| 成人免费视频视频| 亚洲免费av观看| 欧美日韩一级大片网址| 另类小说色综合网站| 久久综合狠狠综合久久综合88| 国产91精品一区二区麻豆亚洲| 国产精品麻豆视频| 欧美午夜宅男影院| 免费不卡在线观看| 欧美激情在线看| 色悠悠亚洲一区二区| 日韩精品一级中文字幕精品视频免费观看 | 日韩欧美成人午夜| 国产精品一区二区久久不卡| 国产精品不卡在线| 欧美日本一区二区| 久久国产夜色精品鲁鲁99| 国产亚洲欧美日韩日本| 色综合视频在线观看| 免费国产亚洲视频| 国产精品女人毛片| 欧美性极品少妇| 国产老女人精品毛片久久| 亚洲美女淫视频|