# C++ Help.. Double linked list



## garrettw09 (Feb 10, 2008)

I need to use a double linked list with a single pointer using the XOR (^) command..

for my next function I have :


bool LinkedList::next()
{
Node *prev, *temp;

temp->ptr = static_cast<int>(prev->ptr) ^ static_cast<int>(current->ptr);
prev->ptr = current->ptr;
current->ptr = temp->ptr;
}

I keep getting the error:

error C2296: '^' : illegal, left operand has type 'Node *'

and it needs to be return type bool. Any suggestions?? And if I don't have the static_cast<int> it gives me the same error..


----------



## MattBro (Nov 11, 2006)

First of all, why are you xor'ing two pointers together? Regardless, just do this:
((Dword) pLeftPtr) ^ ((Dword*) pRightPtr).


----------

