Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2007-10-19 07:30:55


by now I have intrusive pass all regression tests locally. There is one
modification left, which I'm not sure off, therefore I would like to ask
for some advice before committing.

All remaining failures are due to the implementation of

template<class Parent, class Member>
inline std::size_t offset_from_pointer_to_member(
   const Member Parent::* ptr_to_member)
#if ... // 1
   return *(const std::ptrdiff_t*)(void*)&ptr_to_member;
#elif ... // 2
   const Parent * const parent = 0;
   const char *const member =
     reinterpret_cast<const char*>(&(parent->*ptr_to_member));
   return std::size_t(member - reinterpret_cast<const char*>(parent));
#else ... // 3
   return (*(const std::ptrdiff_t*)(void*)&ptr_to_member) - 1;

Currently, variant #3 is chosen, which is obviously wrong. I tried both
variant #1 and #2, and both seem to work for CXX. (All tests pass, no
crashes.) So which variant should I choose?

TIA, Markus

Boost list run by bdawes at, gregod at, cpdaniel at, john at