NewStart
BAN USERahh, I misunderstood the question... Jasmeet is right. non template parameter syntax errors are issues. (aka missing semi colon), it should also be noted that these are also only issues if the template is included somewhere.. aka, if template is in a header that is not "included" (#include...) anywhere, it will not complain. (though that might be a given)
- NewStart April 21, 2010i think this would work..
void delete_list(Node** ppNode)
{
// nulls
if (!ppNode || !*ppNode) return;
// one node and circular ?
if (*ppNode && *ppNode->next == *ppNode)
{
delete *ppNode;
*ppNode = NULL;
return;
}
// more then 1 item
Node* pCur = *ppNode;
do
{
Node* pStore = pCur->next;
delete pCur;
pCur = pStore;
}
while(pCur != NULL && pCur != *ppNode) // pCur == null, should not happen if circular
*pNode = NULL;
}
maybe my thoughts are wrong but couldn't you attack this problem another way. I would have two maps. StartBlocks and EverythingElseBlocks. I am assuming that a block is comprised of multiple nodes where each node points to the next node in some other block. If I have misunderstood the "design" this can be adjusted accordingly.
- NewStart May 19, 20101. go through block by block analyzing each "node" in that block.
2. For each node, If node is found in my EverythingElse map then skip it.
3. Add node to "StartNodes"
3. Walk the line for this file and add sub nodes to "EveryThingElse" map. With each node encountered, check against StartNodes. If found, remove and stop (the rest of that file is already in the "EverythingElse".
at the end, I will have discovered all start nodes (in map StartNodes) and a fast lookup to where the rest of the nodes live.
am I way off?