本文整理汇总了C++中BinaryTree::get方法的典型用法代码示例。如果您正苦于以下问题:C++ BinaryTree::get方法的具体用法?C++ BinaryTree::get怎么用?C++ BinaryTree::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryTree
的用法示例。
在下文中一共展示了BinaryTree::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddIndexOnGenre_name
void Genres::AddIndexOnGenre_name()
{
BinaryTree<genresindex> index;
vector<Genre*> vecp;
_data.TreeToVectorPointers(vecp);
for(auto i=0;i<vecp.size();++i)
{
genresindex indice;
indice.key = &(vecp[i]->genre_name());
indice.pointers.push(vecp[i]);
try
{
index.push(indice);
}
catch (...)
{
index.get(indice).pointers.push(vecp[i]);
}
}
index.BalanceTree();
_indexes.push(std::move(index));
_IndexOnGenre_name = _indexes.size() - 1;
}
示例2: AddIndexOnTelephone
void Users::AddIndexOnTelephone()
{
BinaryTree<usersindex> index;
vector<User*> vecp;
_data.TreeToVectorPointers(vecp);
for(auto i=0;i<vecp.size();++i)
{
usersindex indice;
indice.key = &(vecp[i]->FirstName());
indice.pointers.push(vecp[i]);
try
{
index.push(indice);
}
catch (...)
{
index.get(indice).pointers.push(vecp[i]);
}
}
index.BalanceTree();
_indexes.push(std::move(index));
_IndexOnTelephone = _indexes.size() - 1;
}
示例3: AddIndexOnTitle
void Films::AddIndexOnTitle()
{
BinaryTree<filmsindex> index;
vector<Film*> vecp;
_data.TreeToVectorPointers(vecp);
for(auto i=0;i<vecp.size();++i)
{
filmsindex indice;
indice.key = &(vecp[i]->title());
indice.pointers.push(vecp[i]);
try
{
index.push(indice);
}
catch(...)
{
index.get(indice).pointers.push(vecp[i]);
}
}
index.BalanceTree();
_indexes.push(std::move(index));
_IndexOnTitle = _indexes.size() -1;
}
示例4: AddIndexOnBirthDate
void Actors::AddIndexOnBirthDate()
{
BinaryTree<actorsindex> index;
vector<Actor*> vecp;
_data.TreeToVectorPointers(vecp);
for(auto i=0;i<vecp.size();++i)
{
actorsindex indice;
indice.key = &(vecp[i]->BirthDate());
indice.pointers.push(vecp[i]);
try
{
index.push(indice);
}
catch (...)
{
index.get(indice).pointers.push(vecp[i]);
}
}
index.BalanceTree();
_indexes.push(std::move(index));
_IndexOnBirthDate = _indexes.size() - 1;
}
示例5: main
int main(int argc, char* argv[])
{
BinaryTree tree;
string command;
vector<string> commands;
int N;
int i = 0;
int size;
cout << "N = ";
cin >> N;
cin.ignore(numeric_limits<streamsize>::max(), '\n');
while (i < N && i >= 0)
{
cout << i + 1 << ">>";
getline(cin, command);
commands = split(command, ' ');
size = commands.size();
if (size == 0)
{
cout << "Incorrect command. Try again.\n";
i--;
}
else if (size == 2)
{
if (commands[0] == "add")
tree.add(stoi(commands[1]));
else
{
cout << "Incorrect command. Try again.\n";
i--;
}
}
else if (size == 1)
{
try
{
if (commands[0] == "del")
tree.del();
else if (commands[0] == "get")
cout << tree.get() << endl;
else if (commands[0] == "show")
{
tree.show();
cout << endl;
}
else
{
cout << "Incorrect command. Try again.\n";
i--;
}
}
catch (char* message)
{
cout << message << endl;
}
}
else
{
cout << "Incorrect command. Try again.\n";
i--;
}
i++;
}
system("pause");
return 0;
}