is_member_function_pointer implementation

前端 未结 2 990
醉话见心
醉话见心 2021-01-15 14:25

I am trying to implement my own is_member_function_pointer and I\'m having trouble with it.

namespace __implementation
{
    // integral_constan         


        
2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-15 14:54

    Alternatively

    template struct remove_c { typedef T type; };
    template struct remove_c { typedef T type; };
    
    template 
    struct bool_ { static bool const value = C; };
    
    template
    struct is_same : bool_ {};
    
    template
    struct is_same : bool_ { };
    
    template >
    struct is_function : bool_ {};
    
    struct C { };
    
    template
    struct is_function< T, 
       bool_::type const C::*, 
                     typename remove_c::type       C::*>::value> > 
      : bool_ {};
    
    template
    struct is_member_function_pointer_impl : bool_ {};
    
    template
    struct is_member_function_pointer_impl
      : is_function {};
    
    template
    struct is_member_function_pointer 
      : is_member_function_pointer_impl {};
    

提交回复
热议问题