Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8355111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:45:53+00:00 2026-06-09T09:45:53+00:00

Suppose we have template class template <typename T> class MyTem{ public: bool is_T_Pointer(){ <…>

  • 0

Suppose we have template class

template <typename T>
class MyTem{
public:
    bool is_T_Pointer(){
        <...>
    }
};
class Cls : MyTem<Cls>{
    <...>
};
int main(void){
    Cls* classOnHeap = new Cls(); /* T is pointer */
    Cls classOnStack; /* T is not pointer */
    <...>
}

I know this is a bad example but if someone could help me find out if T is pointer from template class that would be great.

Remember we have inheritance with template of same class as base class.

Doesn’t have to be complete implementation, a vague technique will be enough

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T09:45:54+00:00Added an answer on June 9, 2026 at 9:45 am

    If the compiler supports C++11 use std::is_pointer:

    #include <iostream>
    #include <type_traits>
    
    template <typename T>
    class MyTem
    {
    public:
        static const bool IS_POINTER = std::is_pointer<T>::value;
    };
    
    int main()
    {
        std::cout << MyTem<char*>::IS_POINTER << "\n";
        std::cout << MyTem<char>::IS_POINTER << "\n";
        return 0;
    }
    

    See demo http://ideone.com/Mo394 .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

suppose I have a file alpha.h: class Alpha { public: template<typename T> void foo();
Suppose I have: template<typename T> class A { typedef T t_type; void done_work(); };
Suppose a construct like this: class Interface { public: template <typename T> virtual void
Suppose I have a class template <typename T> class A { public: template <typename
suppose you have the code template <template<class> class BaseType> class EST16 : public BaseType<int>
Suppose we have a class: template <class Type> class A { public: void function1(float
Suppose I have a static function template template<int I> void ft() within a struct
Suppose i have class Person { public int Id {get;set;} public string Name {get;set;}
Suppose I have a simple class that Adds: public class Multiply { public int
I have a dilemma. Suppose I have a template class: template <typename ValueT> class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.