dimanche 19 octobre 2014

Does this pattern have any risk?


Vote count:

0




I define a template class like this:



template <typename A, typename B>
class SomeThing
{
~~~
};


ans I want to use SomeThing. Then that isn't neat, so I did this:



typedef SomeThing<X, Y> SomeNewThing;


However, I have some problem yet. The forwarding declaration of SomeNewThing will be this form.



class X;
class Y;
template <typename A, typename B> class SomeThing;
typedef SomeThing<X, Y> SomeNewThing;


It's neat. Rather than using of typedef, I try using inheritance.



class SomeNewThing : public class<X, Y> {};


Except inheritance, it is just an empty class. The forward declaration will be like this.



class SomeNewThing;


It seems that everything's gonna be alright. There are any risk I did't catch?



asked 1 min ago







Does this pattern have any risk?

Aucun commentaire:

Enregistrer un commentaire