Changeset 55


Ignore:
Timestamp:
05/29/13 17:41:38 (12 years ago)
Author:
epyon
Message:
  • offset_of hack added if in future problems will arise
Location:
trunk/nv
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/common.hh

    r15 r55  
    151151} // namespace nv
    152152
     153template <typename OBJ, typename T>
     154inline size_t offset_of(T OBJ::*ptr)
     155{
     156        return ((size_t)&(((OBJ*)0)->*ptr));
     157}
     158
    153159template <typename T, typename U>
    154 T* down_cast(U* x)
     160inline T* down_cast(U* x)
    155161{
    156162#if NV_DEBUG
  • trunk/nv/types.hh

    r54 r55  
    194194                        , flags( 0 )
    195195                        , offset( offsetof( TOBJECT, *field ) )
     196                        // NOTE: if offsetof behaves badly, check offset_of in common.hh
    196197                {
    197198                        flags =
Note: See TracChangeset for help on using the changeset viewer.