本文整理汇总了C++中SArray::size方法的典型用法代码示例。如果您正苦于以下问题:C++ SArray::size方法的具体用法?C++ SArray::size怎么用?C++ SArray::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SArray
的用法示例。
在下文中一共展示了SArray::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insertLeaf
/**
* put a leaf in the tree
*/
void insertLeaf(SString & fullPubName, SArray<SString> &pathToLeaf, int indexOfChildName){
if ((unsigned)indexOfChildName == pathToLeaf.size()){
// we are in the leaf node
if ((getType() & LEAF) == LEAF){
// node already leaf - should NEVER happen - we are trying to
//insert a leaf where there is already one
throw BrowseException();
}
// make the node a leaf (or leaf branch)
nodeType = (TreeNodeType)(nodeType | LEAF);
pubName = fullPubName;
return;
}
// make the node a branch (or leaf branch)
nodeType = (TreeNodeType)(nodeType | BRANCH);
SString childNameToLookFor = pathToLeaf[indexOfChildName];
TreeNode * child = children[childNameToLookFor];
if (child == NULL){
child = new TreeNode(childNameToLookFor);
AddChild(child);
}
// Insert leaf lower down the tree
child->insertLeaf(fullPubName, pathToLeaf, indexOfChildName+1);
}
示例2: copy
// copy values of another array
void copy (SArray<T> const& orig) {
assert(size()==orig.size());
for (size_t idx = 0; idx<size(); ++idx) {
storage[idx] = orig.storage[idx];
}
}
示例3: SArray
// copy constructor
SArray (SArray<T> const& orig)
: storage(new T[orig.size()]), storage_size(orig.size()) {
copy(orig);
}