This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
> class Display > .....
This is not the correct list for this type of question. Instead, I suggest you read "Modern C++ Design" by Andrei Alexandrescu. He also has a useful website: I suggest you look at it.
That said:
class display_policy_type1 { void process() { std::cout << "Type1\n"; } };
class display_policy_type2 { void process() { std::cout << "Type2\n"; };
template<typename Policy> class display : public Policy { };
is the usual design.
-benjamin
Thanks Benjamin for the reply and the suggestions. My doubts are not on the design but in the logic of gcc and templates in general. In particular I don't understand why in the templated version of my code the instruction
works correctly (t is a const int declared inside the main() ). In fact I do not want to declare Display as template since the function f() must remain with its syntax. I don't know if this is the correct mailing list but I thought that this prolem could address well in standard c++ implementation related questions.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |