default typedefs initlisation

  • Thread starter Abhishek Saksena
  • Start date
A

Abhishek Saksena

Does anybody know how I can achieve the following

I have different flavors of base class :-
========================
class base //empty class
{

};

class base //base class with x_type defination
{
public:
typedef int x_type;
}

class base //base class with y_type defination
{
public:
typedef int y_ype;
}

class base //base class with x_type and y_type defination
{
public:
typedef int x_type;
typedef int y_ype;
}
==========================

now I want to use one of these base class as a template parameter to some
other class. Something like

template<typaname T>
class xyz
{
typedef typename T::x_type x_type;
typedef typename T::y_type y_type;
};

The issue is that if the both or one of the types not defined in the base
class then I would like to initialize the x_type and y_type (defined in
class xyz) to some default type like bool.(without generating the
compile-time error)


Abhishek
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top