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

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

?? unique_tree.inl

?? C++ STL 中沒(méi)有樹形容器是最大的遺憾! 還好高手總是能及時(shí)出現(xiàn)
?? INL
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/*******************************************************************************
Tree Container Library: Generic container library to store data in tree-like structures.
Copyright (c) 2006  Mitchel Haas

This software is provided 'as-is', without any express or implied warranty. 
In no event will the author be held liable for any damages arising from 
the use of this software.

Permission is granted to anyone to use this software for any purpose, 
including commercial applications, and to alter it and redistribute it freely, 
subject to the following restrictions:

1.	The origin of this software must not be misrepresented; 
you must not claim that you wrote the original software. 
If you use this software in a product, an acknowledgment in the product 
documentation would be appreciated but is not required.

2.	Altered source versions must be plainly marked as such, 
and must not be misrepresented as being the original software.

3.	The above copyright notice and this permission notice may not be removed 
or altered from any source distribution.

For complete documentation on this library, see http://www.datasoftsolutions.net
Email questions, comments or suggestions to mhaas@datasoftsolutions.net
*******************************************************************************/
#include <algorithm>

// copy constructor
template<typename stored_type, typename node_compare_type, typename node_order_compare_type>
tcl::unique_tree<stored_type, node_compare_type, node_order_compare_type>::unique_tree( const tree_type& rhs ) 
	: associative_tree_type(rhs), pOrphans(0), allowing_orphans(false)
{
	allowing_orphans = rhs.allowing_orphans;  // copy orphan flag

	if (rhs.pOrphans) { // orphans present?
		basic_tree_type::allocate_tree_type(pOrphans, tree_type());
		typename associative_tree_type::const_iterator it = rhs.pOrphans->begin();
		const typename associative_tree_type::const_iterator it_end = rhs.pOrphans->end();
		for ( ; it != it_end; ++it ) { // copy orphans
			pOrphans->insert(*it.node());
		}
	} else 
		pOrphans = 0;

	typename associative_tree_type::const_iterator it = rhs.begin();
	const typename associative_tree_type::const_iterator it_end = rhs.end();
	for ( ; it != it_end; ++it ) { // do deep copy by inserting children (and descendants)
		insert(*it.node());
	}
}

// assignment operator
template<typename stored_type, typename node_compare_type, typename node_order_compare_type>
tcl::unique_tree<stored_type, node_compare_type, node_order_compare_type>& 
tcl::unique_tree<stored_type, node_compare_type, node_order_compare_type>::operator = (const tree_type& rhs)
{
	if (!associative_tree_type::is_root()) // can assign only to root node
		return *this;

	if ( this == &rhs )  // check for self assignment
		return *this;

	clear();
	basic_tree_type::operator =(rhs); // base class operation

	allowing_orphans = rhs.allowing_orphans;

	if (rhs.pOrphans) { // orphans present?
		basic_tree_type::allocate_tree_type(pOrphans, tree_type());  // yes.  copy them
		typename associative_tree_type::const_iterator it = rhs.pOrphans->begin();
		const typename associative_tree_type::const_iterator it_end = rhs.pOrphans->end();
		for ( ; it != it_end; ++it ) {
			pOrphans->insert(*it.node());
		}
	} else 
		pOrphans = 0;

	typename associative_tree_type::const_iterator it = rhs.begin();
	const typename associative_tree_type::const_iterator it_end = rhs.end();
	for ( ; it != it_end; ++it ) {  // copy all children (and descendants)
		insert(*it.node());
	}

	return *this;
}


// set(const tree_type&)
template<typename stored_type, typename node_compare_type, typename node_order_compare_type>
void tcl::unique_tree<stored_type, node_compare_type, node_order_compare_type>::set(const tree_type& tree_obj)
{
	if ( !check_for_duplicate(*tree_obj.get(), this)) { // duplicate node exist in tree?
		// no.  OK to set this node
		basic_tree_type::set(*tree_obj.get());

		typename associative_tree_type::const_iterator it = tree_obj.begin(), it_end = tree_obj.end();
		for ( ; it != it_end; ++it ) { // insert any children
			insert(*it.node());
		}

		if ( tree_obj.pOrphans && allow_orphans() ) { // copy orphans if any present
			get_root()->pOrphans->set(*tree_obj.pOrphans );
		}  

	}
}


// insert(const stored_type&)
template<typename stored_type, typename node_compare_type, typename node_order_compare_type>
typename tcl::unique_tree<stored_type, node_compare_type, node_order_compare_type>::child_iterator 
tcl::unique_tree<stored_type, node_compare_type, node_order_compare_type>::insert(const stored_type& value) 
{ 
	const tree_type* const pRoot = get_root();
	if ( allow_orphans() && pRoot->pOrphans ) { // orphans present?
		// yes.  check orphans for child
		typename associative_tree_type::iterator oit = pRoot->pOrphans->find_deep(value);
		if ( oit != pRoot->pOrphans->end() ) { 
			// child is an orphan.  update orphan with new data
			oit.node()->set(stored_type(value));
			tree_type orphan;
			orphan.set(*oit.node());
			pRoot->pOrphans->erase(*oit);
			return insert(orphan);
		} 
	} 
	
	// stored obj doesn't already exist in an orphan
	if ( !check_for_duplicate(value, this)) { // check for duplication
		const typename associative_tree_type::iterator it = associative_tree_type::insert(value, this);
		ordered_children.insert(it.node());  // no duplicate exists.  insert new node
		inform_grandparents(it.node(), this );
		return it;
	} else
		return associative_tree_type::end(); // duplicate node exists.  don't insert

}

// insert(const tree_type&)
template<typename stored_type, typename node_compare_type, typename node_order_compare_type>
typename tcl::unique_tree<stored_type, node_compare_type, node_order_compare_type>::child_iterator 
tcl::unique_tree<stored_type, node_compare_type, node_order_compare_type>::insert(const tree_type& tree_obj )
{
	if ( tree_obj.pOrphans && allow_orphans() ) { // have orphans?
		get_root()->pOrphans->insert(*tree_obj.pOrphans ); // yes.  copy orphans
	}  

	// insert current node
	typename associative_tree_type::iterator base_it = insert(*tree_obj.get());

	if ( base_it == associative_tree_type::end() ) { // insert successful?
		// no.  but, the node may have existed here previously.  check if so
		base_it = associative_tree_type::find(*tree_obj.get()); 
	}

	if ( base_it != associative_tree_type::end() ) {  // node exist?
		typename associative_tree_type::const_iterator it = tree_obj.begin();
		const typename associative_tree_type::const_iterator it_end = tree_obj.end();

		// call this function recursively to insert children and descendants
		for ( ; it != it_end; ++it )
			base_it.node()->insert(*it.node());
	}
	return base_it;
}

// insert(const stored_type&, const stored_type&)
template<typename stored_type, typename node_compare_type, typename node_order_compare_type>
typename tcl::unique_tree<stored_type, node_compare_type, node_order_compare_type>::child_iterator 
tcl::unique_tree<stored_type, node_compare_type, node_order_compare_type>::insert( const stored_type& parent_obj, const stored_type& value)
{
	if ( !(parent_obj < *this->get()) && !(*this->get() < parent_obj) ) { // is this node the parent?	
		return insert(value);  // yes.  insert the node here.
	}

	// find parent node
	typename associative_tree_type::iterator it, it_parent = find_deep(parent_obj);

	const tree_type* const pRoot = get_root();
	if ( it_parent != associative_tree_type::end() ) {
		// found parent node, 
		if ( allow_orphans() && pRoot->pOrphans ) {
			// orphans present.  check orphans for child
			typename associative_tree_type::iterator oit = pRoot->pOrphans->find_deep(value);
			if ( oit != pRoot->pOrphans->end() ) {
				// child is an orphan.  update orphan with new data
				oit.node()->set(stored_type(value));
				tree_type orphan;
				orphan.set(*oit.node());
				pRoot->pOrphans->erase(*oit);
				it = it_parent.node()->insert(orphan);
			} else
				it = it_parent.node()->insert(value); // child not an orphan. inset child node in parent 
		} else {
			it = it_parent.node()->insert(value); // no orphans.  insert child node in parent
		}
		if ( it == it_parent.node()->end() ) // was node inserted successfully?
			return associative_tree_type::end(); // no.  return proper end()
	} else if (allow_orphans() ) { 
		// parent not found.  do we have orphans?
		if ( !pRoot->pOrphans ) {
			basic_tree_type::allocate_tree_type(pRoot->pOrphans, tree_type());  // no, instanciate them
		}

		typename associative_tree_type::iterator oit = pRoot->pOrphans->find_deep(parent_obj);

		// orphans contain parent?
		if ( oit == pRoot->pOrphans->end() ) {
			// no.  create parent in orphans
			oit = pRoot->pOrphans->insert(parent_obj);
			pRoot->pOrphans->ordered_children.clear();  // orphans need no ordered children
		} 

		typename associative_tree_type::iterator child_oit = pRoot->pOrphans->find_deep(value);
		if ( child_oit != pRoot->pOrphans->end() ) {
			// child is an orphan.  update orphan with new data
			child_oit.node()->set(stored_type(value));
			tree_type orphan;
			orphan.set(*child_oit.node());
			pRoot->pOrphans->erase(*child_oit);
			it = oit.node()->insert(orphan);
			oit.node()->ordered_children.clear();

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩你懂得| 欧美日韩一级大片网址| 日韩av在线播放中文字幕| 最新国产成人在线观看| 国产欧美日韩激情| 久久精品男人天堂av| 久久亚洲免费视频| 久久久精品影视| 久久午夜色播影院免费高清| 精品国产1区二区| 精品日韩在线观看| 久久婷婷国产综合精品青草| 久久理论电影网| 中文字幕不卡三区| 国产精品传媒入口麻豆| 亚洲欧美一区二区三区国产精品| 国产精品蜜臀av| 亚洲日本在线视频观看| 亚洲综合视频网| 爽好久久久欧美精品| 久久精品免费观看| 国产成人在线观看免费网站| eeuss鲁一区二区三区| 91免费看视频| 欧美日韩亚洲国产综合| 欧美高清视频在线高清观看mv色露露十八 | 91麻豆精东视频| 精品视频一区三区九区| 欧美夫妻性生活| 精品88久久久久88久久久| 久久精品夜色噜噜亚洲aⅴ| 国产精品毛片大码女人| 一区二区三区中文字幕在线观看| 亚欧色一区w666天堂| 捆绑紧缚一区二区三区视频| 高清不卡在线观看| 在线观看国产一区二区| 日韩一区二区免费视频| 国产日韩欧美制服另类| 亚洲精品视频一区二区| 婷婷激情综合网| 国产精品乡下勾搭老头1| 色婷婷亚洲婷婷| 日韩欧美亚洲一区二区| 中文字幕在线观看一区二区| 亚洲国产成人av网| 日韩激情一二三区| 美腿丝袜亚洲三区| 国产成a人无v码亚洲福利| 99精品久久只有精品| 欧美日韩一区二区三区在线| 久久免费的精品国产v∧| 亚洲天堂2016| 激情综合网最新| 在线精品视频一区二区三四| 久久综合色婷婷| 亚洲综合另类小说| 国产精品自在在线| 欧美日韩日日骚| 国产精品五月天| 免费在线看一区| 91在线观看成人| wwwwxxxxx欧美| 亚洲午夜久久久久| 成人免费av在线| 日韩精品最新网址| 亚洲一区国产视频| 成人免费va视频| 日韩欧美一二三四区| 一区二区日韩电影| 成人午夜伦理影院| 精品国产第一区二区三区观看体验| 91精彩视频在线观看| 欧美四级电影在线观看| 国产色91在线| 日韩成人一区二区三区在线观看| 成人av在线资源网站| 精品国偷自产国产一区| 亚洲国产一二三| av影院午夜一区| 久久九九全国免费| 久久精品国产亚洲一区二区三区| 欧美在线不卡视频| 亚洲欧洲性图库| 国产成人亚洲综合色影视| 日韩精品一区二区三区中文精品| 亚洲尤物视频在线| 91丨porny丨户外露出| 国产欧美视频一区二区| 精品无人码麻豆乱码1区2区| 欧美日韩国产在线播放网站| 一区二区三区欧美| 99r国产精品| 国产精品动漫网站| 国产成人在线看| 国产欧美一区二区精品性色| 精品亚洲成a人在线观看| 欧美一区二区三区白人| 污片在线观看一区二区| 欧美日韩专区在线| 亚洲成人自拍网| 欧美一区日本一区韩国一区| 亚洲一区二区三区在线播放| 国产欧美一区二区三区在线看蜜臀 | 91美女片黄在线| 国产精品久久久久久久岛一牛影视 | 9191久久久久久久久久久| 一个色妞综合视频在线观看| 色综合天天在线| 亚洲免费在线看| 欧洲精品在线观看| 亚洲18色成人| 91精品啪在线观看国产60岁| 日韩激情一区二区| 欧美一级精品在线| 极品少妇一区二区| 欧美国产一区视频在线观看| 风间由美中文字幕在线看视频国产欧美 | 高清在线成人网| 国产精品视频看| 一本一道综合狠狠老| 尤物av一区二区| 7777精品伊人久久久大香线蕉的| 日本va欧美va精品| 久久久久久久综合色一本| 国产成人欧美日韩在线电影| 国产精品久久久久毛片软件| 91在线视频播放地址| 亚洲亚洲人成综合网络| 在线观看91av| 韩国精品在线观看| 国产精品麻豆网站| 欧洲一区二区三区免费视频| 日本不卡的三区四区五区| 精品国产乱码久久久久久免费 | 91国产福利在线| 日韩黄色片在线观看| 久久综合狠狠综合久久综合88| 丰满少妇久久久久久久| 亚洲精品中文字幕在线观看| 日韩精品亚洲专区| 欧美日韩视频在线一区二区| 青青草精品视频| 久久精品一区二区三区不卡| 91麻豆国产精品久久| 日韩极品在线观看| 欧美韩国日本不卡| 欧美日韩国产在线观看| 国产一区二区毛片| 亚洲乱码中文字幕综合| 精品视频在线视频| 国产一区二区三区四区五区美女| 亚洲视频 欧洲视频| 91精品国产综合久久蜜臀| 成人精品一区二区三区中文字幕| 亚洲一区二区中文在线| 久久在线观看免费| 欧美视频在线观看一区二区| 国模一区二区三区白浆| 伊人婷婷欧美激情| 久久久久久久久久久电影| 色综合久久久久综合体桃花网| 另类调教123区 | 一二三区精品视频| 国产亚洲成aⅴ人片在线观看| 欧美四级电影在线观看| 成人午夜在线视频| 男人的天堂亚洲一区| 一区二区在线免费观看| 久久精品夜夜夜夜久久| 91.xcao| av电影在线观看一区| 麻豆成人av在线| 亚洲一区二区三区中文字幕在线 | 亚洲成人av资源| 国产精品免费久久| 精品福利一区二区三区免费视频| 欧美影片第一页| 成人午夜看片网址| 国产麻豆精品久久一二三| 午夜一区二区三区在线观看| 综合自拍亚洲综合图不卡区| 久久一留热品黄| 日韩三级视频在线观看| 欧美最新大片在线看| aaa欧美日韩| 国产一区二区精品久久| 奇米在线7777在线精品 | 色综合天天综合网天天狠天天| 国产一区二区三区久久久 | 久久国产三级精品| 午夜精品影院在线观看| 依依成人精品视频| 日韩理论电影院| 中文字幕亚洲精品在线观看| 国产亚洲综合性久久久影院| 26uuu另类欧美亚洲曰本| 日韩欧美中文字幕精品| 欧美精品日韩综合在线| 欧美色偷偷大香|