Show
Ignore:
Timestamp:
07/03/08 16:13:48 (5 months ago)
Author:
kazuho
Message:

add getter()

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/cplusplus/reflection/trunk/memrebuild.hpp

    r14745 r15103  
    119119 
    120120#undef MEM_REBUILD_ 
    121  
    122   template <typename T, typename TI> T core(const void *p, TI t) 
     121   
     122  template <typename T, typename TI> 
     123  typename builder<T>::func_t get_instantiator(TI t) 
    123124  { 
    124     typedef mem_rebuild_ns::builder_map<T> map; 
    125     for (typename map::const_iterator i = map::m.begin(); 
    126          i != map::m.end(); 
     125    for (typename builder_map<T>::const_iterator i = builder_map<T>::m.begin(); 
     126         i != builder_map<T>::m.end(); 
    127127         ++i) { 
    128128      typename mem_rebuild_ns::builder<T>::func_t instantiate; 
    129129      if ((instantiate = (*i)->get(t)) != NULL) 
    130         return (*instantiate)(p); 
     130        return instantiate; 
    131131    } 
    132132    throw std::bad_cast(); 
     133  } 
     134   
     135  template <typename T, typename TI> T core(const void *p, TI t) 
     136  { 
     137    return (*get_instantiator<T, TI>(t))(p); 
    133138  } 
    134139