本文整理汇总了C++中tree_t::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ tree_t::remove方法的具体用法?C++ tree_t::remove怎么用?C++ tree_t::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tree_t
的用法示例。
在下文中一共展示了tree_t::remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set
void set(const char *name, const char *value)
{
node *n = tree.search(name);
if (!n)
{
// This variable does not currently exist. Create a node for it.
n = new node;
n->name = new char [strlen(name) + 2];
strcpy(n->name + 1, name);
tree.insert(n);
}
else
// Delete current value.
delete [] n->value;
if (value)
{
if (strlen(value) == 0)
value = 0;
}
if (value)
{
n->value = new char [strlen(value) + 1];
strcpy(n->value, value);
}
else
{
// Variable is being set to empty string, which deletes it.
tree.remove(name);
delete [] n->name;
delete n;
}
}