In my code Graph
is a class having a member node
, which is a structure. When I do
unsigned int id = ((unsigned int)n - (unsigned int)_nodes) / sizeof(Graph::node);
I get the following error (compiled on 64-bit Linux):
error: cast from ‘Graph::node* {aka Graph::node_st*}’ to ‘unsigned int’ loses precision [-fpermissive]
Googled and found a similar question but it does not seem to me that the answer is applicable here (note that I want to get the size of the object but not itself).
Thank you in advance for any suggestions!