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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ropeimpl.h

?? TSP問題的一個(gè)類庫 有源代碼和stl
?? H
?? 第 1 頁 / 共 4 頁
字號(hào):
/*
 * 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;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产mv日韩mv欧美| 丰满白嫩尤物一区二区| 久久久久亚洲蜜桃| 在线观看三级视频欧美| 国产露脸91国语对白| 亚洲综合在线观看视频| 欧美xxxxx裸体时装秀| 91福利国产成人精品照片| 国产尤物一区二区| 日韩av在线免费观看不卡| 中文字幕制服丝袜成人av| 日韩免费看的电影| 欧美色老头old∨ideo| 成人黄色小视频| 美女高潮久久久| 成人免费av网站| 蜜桃视频一区二区三区| 亚洲综合在线免费观看| 国产精品福利电影一区二区三区四区| 欧美一区二区福利在线| 欧美午夜免费电影| av毛片久久久久**hd| 国产福利91精品| 韩日av一区二区| 免费的成人av| 日韩国产一区二| 亚洲影视在线观看| 一区二区三区四区蜜桃 | 欧美日韩一区二区三区在线| 成人精品小蝌蚪| 国产.欧美.日韩| 国产精品香蕉一区二区三区| 九色porny丨国产精品| 石原莉奈在线亚洲三区| 亚洲一级二级在线| 亚洲成a天堂v人片| 五月综合激情日本mⅴ| 午夜精品久久一牛影视| 婷婷开心久久网| 天天综合网天天综合色| 午夜精品久久久久久久99水蜜桃 | 欧美三电影在线| 欧美三级中文字幕| 欧美三级蜜桃2在线观看| 色一情一伦一子一伦一区| 91伊人久久大香线蕉| 91亚洲资源网| 日本道色综合久久| 欧美午夜精品久久久| 91福利国产成人精品照片| 欧美天堂亚洲电影院在线播放| 在线观看av一区二区| 欧美亚洲尤物久久| 欧美久久久久免费| 日韩女优电影在线观看| 欧美va亚洲va| 欧美国产欧美综合| 中文字幕一区av| 亚洲一区二区在线播放相泽 | 国产成人aaa| 91亚洲精品久久久蜜桃| 欧美午夜一区二区三区| 欧美剧在线免费观看网站 | 狠狠色综合色综合网络| 国产精品自拍一区| 99精品在线观看视频| 欧美亚洲国产怡红院影院| 91麻豆精品国产综合久久久久久| 日韩欧美亚洲一区二区| 国产欧美综合在线观看第十页| 国产精品乱码一区二区三区软件| 亚洲靠逼com| 天使萌一区二区三区免费观看| 久久精品国产网站| 不卡一卡二卡三乱码免费网站| 日本乱码高清不卡字幕| 欧美一区二区免费视频| 国产视频一区在线播放| 夜夜亚洲天天久久| 精品一区二区三区不卡| 成人av手机在线观看| 欧美日韩一区二区三区在线| 久久在线观看免费| 一区二区成人在线| 美国十次综合导航| 91亚洲精华国产精华精华液| 欧美美女一区二区在线观看| 欧美激情一区二区在线| 亚洲成人精品一区| 成人妖精视频yjsp地址| 欧美一区二区黄| 亚洲另类色综合网站| 韩国在线一区二区| 欧美年轻男男videosbes| 国产人久久人人人人爽| 午夜精品一区二区三区电影天堂| 国产福利一区二区| 欧美日韩午夜在线视频| 中文字幕乱码一区二区免费| 日韩影院精彩在线| 99国产一区二区三精品乱码| 欧美videossexotv100| 一区二区三区中文字幕| 国产精一品亚洲二区在线视频| 欧美日韩在线播| 国产精品进线69影院| 久久av资源网| 欧美日韩国产成人在线91| 综合中文字幕亚洲| 国产乱码一区二区三区| 日韩小视频在线观看专区| 亚洲精品成a人| 粉嫩久久99精品久久久久久夜| 91精品免费在线观看| 亚洲国产精品视频| 99精品黄色片免费大全| 欧美国产激情一区二区三区蜜月| 男女激情视频一区| 678五月天丁香亚洲综合网| 夜夜嗨av一区二区三区中文字幕| 粉嫩av一区二区三区粉嫩| 亚洲精品一区二区精华| 日本最新不卡在线| 777午夜精品免费视频| 亚洲韩国精品一区| 色一情一乱一乱一91av| 亚洲欧美一区二区在线观看| 成人午夜又粗又硬又大| 日韩一级二级三级| 午夜视频在线观看一区| 欧美日韩一区二区三区不卡| 亚洲自拍偷拍av| 欧美丝袜丝nylons| 丝袜亚洲另类欧美综合| 欧美军同video69gay| 日韩专区欧美专区| 欧美精品乱码久久久久久按摩| 亚洲福利视频一区| 欧美日韩免费观看一区三区| 亚洲一区二区高清| 欧美精品一二三四| 麻豆成人91精品二区三区| 日韩精品资源二区在线| 久久99最新地址| 欧美精品一区二| 丁香婷婷综合五月| 成人欧美一区二区三区白人| 99久久免费视频.com| 一区二区三区视频在线看| 欧美亚洲精品一区| 麻豆精品一区二区三区| 久久品道一品道久久精品| 国产成人免费xxxxxxxx| 最近中文字幕一区二区三区| 色8久久人人97超碰香蕉987| 亚洲国产精品一区二区www在线| 69堂成人精品免费视频| 精品在线视频一区| 国产精品传媒入口麻豆| 欧美在线观看禁18| 免费欧美日韩国产三级电影| 久久这里只精品最新地址| 成人av片在线观看| 午夜天堂影视香蕉久久| 亚洲精品在线一区二区| 不卡一区二区中文字幕| 亚洲成av人片在线观看| 精品国产免费一区二区三区四区 | 亚洲男同1069视频| 制服丝袜亚洲色图| 国产91丝袜在线播放九色| 亚洲日本免费电影| 欧美一二三在线| 99精品欧美一区| 美女诱惑一区二区| 久久精品一区二区三区av| 91官网在线观看| 国内精品写真在线观看| 亚洲人123区| 欧美一级在线视频| 99久久国产综合精品色伊| 日本一区中文字幕 | 一区二区激情小说| 久久色在线观看| 欧美自拍丝袜亚洲| 国产精品77777竹菊影视小说| 一区二区三区欧美视频| 精品对白一区国产伦| 91久久精品一区二区三| 国内精品写真在线观看| 亚洲一区二区三区四区五区中文| 精品国产一区二区亚洲人成毛片 | 在线精品视频一区二区| 国产精品资源在线观看| 亚洲一区二三区| 国产精品区一区二区三区| 3atv一区二区三区| 91国产免费观看| 国产iv一区二区三区| 久久国产三级精品|