|
Boost Users : |
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2007-06-05 10:35:16
Zeljko Vrba wrote:
> No, the data stored in the pointer-to-member is *not* the "real" offset,
> contrary to your assumption :) When checking in the debugger, the hook
> is aligned properly.
I just realized about this just after sending my previous mail. SunCC
seems to use the classical cfront approach encoding a pointer to member
as offset + 1. So it seems that parent_from_member detection is correct
for SunCC.
>> Could you check the real distance between klass and hook_? Something like:
>>
> The statement (after adding 'klass k' in the local scope of main())
>
> cout << (char*)&k.hook_ - (char*)&k << endl;
>
> prints out 84.
Thanks. Really useful information.
> Furthermore, given the following program:
> [snip]
>
> int main(void)
> {
> Gl.push_back(Gd);
> return 0;
> }
> [snip]
> So, the "to_insert" does not point to the hook address, but to the very
> beginning of the structure.
So the problem lies in ValueTraits::to_node_ptr() which just should use
the pointer to member template to get the address of the hook. But for
some reason, it does not work. The real logic for the conversion is
boost/intrusive/detail/utilities.hpp in the member_value_traits class:
static node_ptr to_node_ptr(reference value)
{
MemberHookType* result = &(value.*P);
return result->to_node_ptr();
}
So I'm a bit puzzled this does not work (we are not using the
non-standard hack here). If you can debug it further, let me know.
Meanwhile, I will download the SunCC version for Linux to see what happens.
Thanks again for your help,
Ion
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net