Namespaces
Variants
Views
Actions

Talk:cpp/types/add pointer

From cppreference.com

[edit] Possible implementation looks surprisingly complex — Why?

Why is the "possible implementation" so complex? I thought this would also do:

template<class T>
  struct add_pointer
  {
     typedef T* type;
  };

--Roker (talk) 07:57, 21 September 2023 (PDT)

you can paste it in to the example on this page (and remove std:: from add_pointer calls it makes so it calls yours instead) and see where it fails --Cubbi (talk) 08:47, 21 September 2023 (PDT)