c++ - Converting a class to a template -
I want to convert a class to a template and this class needs access to some data by type name. In this case typename T can be an object or pointer for objects. How do I tell within the template if I am working with a pointer or an object?
I can not use Boost.
You will use a template expert First of all, you can use your template as the default type of template parameter Make them.
template & lt; Typename T & gt; Structure fu {t t_; Fu () {std :: cout & lt; & Lt; "Regular edition" & lt; & Lt; Std :: endl; }}; After that, you will be the specialist for that template when it will be some kind of indicator. template & lt; Typename T & gt; Structure foo & lt; T * & gt; {T * T_; Fu () {std :: cout & lt; & Lt; "Notifier version" & lt; & Lt; Std :: endl; }}; Foo & LT; Integer & gt; a; Foo & lt; Int * & gt; B;
Comments
Post a Comment