how to implement is_pointer?

后端 未结 4 1323
长情又很酷
长情又很酷 2020-12-31 19:09

I want to implement is_pointer. I want something like this:

template 
bool is_pointer( T t )
{
   // implementation
} // return true or fa         


        
4条回答
  •  余生分开走
    2020-12-31 19:23

    From Dr. Dobbs.

    template  
    struct is_pointer 
    { static const bool value = false; };
    
    template  
    struct is_pointer 
    { static const bool value = true; };
    

    You can't do exactly what you want to do. You'll have to use this like:

    is_pointer::value
    

    It's not possible to determine this at run time.

提交回复
热议问题