Displaying 5 results from an estimated 5 matches for "mbrtype".
2012 Oct 02
2
[LLVMdev] Offset to C++ structure members
...rite a "thunk" wrapper to call it. However, assume that there is no such S member function. I therefore need a way to get the offset of 'b' and add it to 's' so that I can call T_string_M_assign_Pv() on it.
Given this helper function:
template<class ClassType,class MbrType> inline
ptrdiff_t mbr_offset_of( MbrType ClassType::*p ) {
ClassType const *const c = static_cast<ClassType*>( nullptr );
return reinterpret_cast<ptrdiff_t>( &(c->*p) );
}
I could take a Pointer to an S, use ptrtoint, add the offset, use inttoptr, and use that pointer...
2012 Oct 02
2
[LLVMdev] Offset to C++ structure members
...volved.
Really? This simple code works just fine:
struct A { int ai; };
struct X : virtual A { int xi; };
struct Y : virtual A { int yi; };
struct S : X, Y {
string a;
string b;
};
template<class ClassType,class MbrType> inline
ptrdiff_t mbr_offset_of( MbrType ClassType::*p ) {
ClassType const *const c = static_cast<ClassType*>( nullptr );
return reinterpret_cast<ptrdiff_t>( &(c->*p) );
}
int main() {
ptrdiff_t offset = mbr_offset_of( &am...
2012 Oct 02
0
[LLVMdev] Offset to C++ structure members
...wrapper to call it. However, assume that there is no such S member function. I therefore need a way to get the offset of 'b' and add it to 's' so that I can call T_string_M_assign_Pv() on it.
>
> Given this helper function:
>
> template<class ClassType,class MbrType> inline
> ptrdiff_t mbr_offset_of( MbrType ClassType::*p ) {
> ClassType const *const c = static_cast<ClassType*>( nullptr );
> return reinterpret_cast<ptrdiff_t>( &(c->*p) );
> }
>
> I could take a Pointer to an S, use ptr...
2012 Oct 02
0
[LLVMdev] Offset to C++ structure members
...>
> struct A { int ai; };
> struct X : virtual A { int xi; };
> struct Y : virtual A { int yi; };
>
> struct S : X, Y {
> string a;
> string b;
> };
>
> template<class ClassType,class MbrType> inline
> ptrdiff_t mbr_offset_of( MbrType ClassType::*p ) {
> ClassType const *const c = static_cast<ClassType*>( nullptr );
> return reinterpret_cast<ptrdiff_t>( &(c->*p) );
> }
>
> int main() {
> ptr...
2012 Oct 02
1
[LLVMdev] Offset to C++ structure members
...{ int ai; };
>> struct X : virtual A { int xi; };
>> struct Y : virtual A { int yi; };
>>
>> struct S : X, Y {
>> string a;
>> string b;
>> };
>>
>> template<class ClassType,class MbrType> inline
>> ptrdiff_t mbr_offset_of( MbrType ClassType::*p ) {
>> ClassType const *const c = static_cast<ClassType*>( nullptr );
>> return reinterpret_cast<ptrdiff_t>( &(c->*p) );
>> }
>>
>> int main()...