type_info::__is_pointer_p() not working?

Carlo Wood carlo@alinoe.com
Sat Apr 28 19:21:00 GMT 2001


Shouldn't this work?

-------------------------------------------
#include <iostream>
#include <typeinfo>
 
int main(void)
{
  if (typeid(int*).__is_pointer_p())
    std::cout << "int* is a pointer.\n";
  else
    std::cout << "int* is not a pointer?!\n";

  return 0;
}
-------------------------------------------

>g++-3.0 pointer.cc
>a.out
int* is not a pointer?!

If it shouldn't work, then how CAN I check if a
template parameter is a pointer or not?  I used
to use some overload trick, but recently 3.0 was
changed to refuse my trick (before it only failed
with -pendantic).

-- 
Carlo Wood <carlo@alinoe.com>



More information about the Gcc mailing list