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

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

?? unique_tree.inl

?? C++ STL 中沒有樹形容器是最大的遺憾! 還好高手總是能及時出現
?? INL
?? 第 1 頁 / 共 2 頁
字號:
/*******************************************************************************
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();

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产精品麻豆| 成人欧美一区二区三区黑人麻豆 | 中文天堂在线一区| 国产99久久久国产精品潘金| 国产欧美一区二区三区沐欲| 成人视屏免费看| 亚洲男人的天堂一区二区| 日本韩国欧美一区| 午夜不卡av在线| 欧美成人猛片aaaaaaa| 国产河南妇女毛片精品久久久 | 国产精品久久免费看| 91麻豆swag| 日韩精品久久理论片| 欧美tk丨vk视频| 99综合影院在线| 性感美女久久精品| 久久只精品国产| 色哟哟一区二区在线观看| 男女激情视频一区| 国产欧美一区二区在线观看| 色吧成人激情小说| 久久精品99国产精品日本| 国产精品嫩草久久久久| 欧美伊人精品成人久久综合97| 青青草国产精品97视觉盛宴| 国产日韩成人精品| 777午夜精品视频在线播放| 国产高清精品在线| 午夜视频一区二区三区| 国产精品每日更新| 欧美一区二区播放| 色婷婷精品久久二区二区蜜臂av| 免费的国产精品| 一个色综合av| 国产欧美一区二区精品秋霞影院 | 99免费精品视频| 免费不卡在线观看| 一区二区三区中文免费| 久久久久久久免费视频了| 欧美日韩一区二区在线观看视频| 国产91综合一区在线观看| 日欧美一区二区| 亚洲色图第一区| 久久中文字幕电影| 666欧美在线视频| 在线欧美日韩精品| 成人午夜私人影院| 国产一区在线观看视频| 日韩在线a电影| 亚洲精品日日夜夜| 欧美国产日本视频| ww久久中文字幕| 欧美大尺度电影在线| 在线播放视频一区| 91福利在线导航| 色婷婷综合在线| 95精品视频在线| 成人h动漫精品一区二区| 国内精品伊人久久久久影院对白| 偷拍亚洲欧洲综合| 五月婷婷激情综合| 午夜不卡av免费| 天天色 色综合| 五月综合激情日本mⅴ| 亚洲成人三级小说| 亚洲成人av中文| 亚洲国产裸拍裸体视频在线观看乱了 | 欧美日韩亚洲丝袜制服| 94色蜜桃网一区二区三区| 成人性色生活片| av在线不卡电影| 91首页免费视频| 一本一道波多野结衣一区二区| yourporn久久国产精品| 成人ar影院免费观看视频| 国产福利一区二区| www.日韩在线| 色综合中文字幕| 欧美色倩网站大全免费| 欧美日韩一区二区欧美激情| 欧美精品xxxxbbbb| 欧美大片在线观看一区二区| 精品黑人一区二区三区久久| 久久影视一区二区| 欧美韩日一区二区三区四区| 国产精品免费av| 一级精品视频在线观看宜春院| 亚洲国产精品一区二区www| 午夜成人免费视频| 久久福利视频一区二区| 国产大片一区二区| 91网站在线播放| 欧美人动与zoxxxx乱| 日韩精品中文字幕在线不卡尤物| 日韩欧美国产一二三区| 国产女主播在线一区二区| 成人免费一区二区三区在线观看| 一区二区三区四区高清精品免费观看 | 欧美麻豆精品久久久久久| 666欧美在线视频| 国产午夜精品一区二区三区嫩草 | 视频一区二区三区中文字幕| 青青草91视频| 成人深夜在线观看| 精品视频在线看| 亚洲精品一区二区精华| 亚洲欧洲无码一区二区三区| 午夜在线成人av| 国产一区二区久久| 欧洲人成人精品| 国产丝袜在线精品| 亚洲成人你懂的| 成人激情免费网站| 欧美精品久久一区二区三区| 久久久www成人免费毛片麻豆 | 99精品在线观看视频| 欧美日韩精品电影| 久久久99久久| 视频一区二区欧美| jlzzjlzz国产精品久久| 日韩一区二区在线看片| 亚洲丝袜另类动漫二区| 久久99精品久久久久久| 色久综合一二码| 欧美国产精品久久| 免费亚洲电影在线| 在线欧美小视频| 国产精品传媒入口麻豆| av在线播放不卡| 精品久久久久久最新网址| 亚洲精品久久嫩草网站秘色| 国产一区二区三区免费看 | 91在线免费视频观看| 欧美sm美女调教| 亚洲福利一区二区| 成人黄动漫网站免费app| 精品少妇一区二区三区日产乱码 | 自拍偷拍亚洲综合| 国产永久精品大片wwwapp| 欧美精品欧美精品系列| 亚洲欧美一区二区三区极速播放| 久久99精品一区二区三区| 欧美日韩免费一区二区三区| 亚洲欧洲综合另类在线| 国产成人久久精品77777最新版本| 91精品国产91久久久久久最新毛片 | 精品日韩欧美在线| 亚洲成人av福利| 欧美亚洲综合另类| 亚洲欧洲综合另类| 99久久久久久| 欧美激情一区二区在线| 国产一区二区美女诱惑| 精品日产卡一卡二卡麻豆| 秋霞电影一区二区| 91精品免费在线| 日日摸夜夜添夜夜添国产精品 | 91蜜桃免费观看视频| 国产精品色一区二区三区| 国产精品一卡二卡在线观看| 日韩精品综合一本久道在线视频| 午夜精品免费在线观看| 欧美日韩日日摸| 亚洲国产精品一区二区久久恐怖片| 色狠狠av一区二区三区| 亚洲一二三区不卡| 欧美日韩不卡在线| 天堂在线一区二区| 欧美男女性生活在线直播观看| 亚洲国产成人91porn| 欧美一区三区二区| 青青青爽久久午夜综合久久午夜| 日韩欧美精品在线| 国产麻豆精品theporn| 久久久精品tv| 成人av资源在线观看| 亚洲精品ww久久久久久p站| 欧美中文字幕亚洲一区二区va在线| 亚洲一区二区三区自拍| 欧美日韩国产bt| 久久99最新地址| 久久精品人人做| 91丨九色porny丨蝌蚪| 亚洲国产日韩一区二区| 精品久久久久久久久久久院品网| 国产成人精品免费看| 亚洲欧美电影一区二区| 欧美日韩一区二区三区四区| 久久99国内精品| 日本一区二区久久| 91福利在线免费观看| 免费观看一级特黄欧美大片| 国产日韩av一区| 日本高清不卡在线观看| 免费观看成人av| 亚洲欧美综合网| 欧美群妇大交群的观看方式| 久久丁香综合五月国产三级网站| 国产精品毛片久久久久久久|