visitor-pattern
Apples, oranges, and pointers to the most derived c++ class
Suppose I have a bunch of fruit: class Fruit { ... }; class Apple : public Fruit { ... }; class Orange: public Fruit { ... };[详细]
2023-01-03 09:14 分类:问答Need help make these classes use Visitor Pattern and generics
I need help to generify and implement the visitor pattern. We are using tons of instanceof and it is a pain. I am sure it can be modified, but I am not sure how to do it.[详细]
2023-01-01 14:10 分类:问答Command Pattern vs. Visitor Pattern
Is it generally acceptable to allow a Visitor to modify state of the Receiver, or should that be 开发者_如何学Pythona Command pattern instead?The purpose of the visitor pattern is to allow new operati[详细]
2022-12-31 17:03 分类:问答Visitor and templated virtual methods
In a typical implementation of the Visitor pattern, the class must account for all variations (descendants) of the base class.There are many instances where the same method content in the visitor is a[详细]
2022-12-31 11:58 分类:问答When do you decide to use a visitors for your objects?
I always thought an object needs the data and the messages to act on it. When would you want a method that is extrinsic to the object? What rule of thumb do you follow to have a visitor? This is suppo[详细]
2022-12-30 12:12 分类:问答Changing a Container while using Visitor
I implemented the Visitor pattern in C++ using a STL-like iterator for storing the Visitor\'s current position in the container. Now I would like to change the container while I开发者_开发百科 iterate[详细]
2022-12-27 04:01 分类:问答Visitor pattern's purpose with examples [duplicate]
This question already has answers here: 开发者_运维问答 When should I use the Visitor Design Pattern? [closed][详细]
2022-12-26 09:37 分类:问答C++ visitor pattern handling templated string types?
I\'m trying to use the visitor pattern to serialize the contents of objects. However one snag I\'m hitting is when I\'m visiting strings. My strings are of a templated type, similar to STL\'s basi开发[详细]
2022-12-25 01:55 分类:问答How to write the Visitor Pattern for Abstract Syntax Tree in Python?
My collegue suggested me to write a visitor pattern to navigate the AST. Can an开发者_StackOverflow中文版yone tell me more how would I start writing it?[详细]
2022-12-24 23:49 分类:问答Java Enums - Switch statements vs Visitor Pattern on Enums - Performance benefits?
I have been searching around for days to find an answer to this performance based issue. After diggingthe Internet so far I have learned that there are couple of ways to use the Enums in java, well do[详细]
2022-12-19 01:39 分类:问答