visitor-pattern Questions
6
Solved
So, I was just reading about the Visitor pattern and I found the back and forth between the Visitor and the Elements very strange!
Basically we call the element, we pass it a visitor and then the e...
Methylnaphthalene asked 3/6, 2021 at 4:54
4
Solved
I'm just trying to understand the main benefits of using the Visitor pattern.
Here's a sample Java implementation
///////////////////////////////////
// Interfaces
interface MamalVisitor {
void ...
Atalie asked 6/6, 2011 at 12:58
12
Solved
I have trouble understanding these two design patterns.
Can you please give me contextual information or an example so I can get a clear idea and be able to map the difference between the two of ...
Beacham asked 29/12, 2011 at 7:59
4
Solved
I am implementing a simple C-like language in OCaml and, as usual, AST is my intermediate code representation. As I will be doing quite some traversals on the tree, I wanted to implement
a visitor ...
Zabrina asked 19/3, 2014 at 5:16
3
The pattern that a lot of people use with C++17 / boost variants looks very similar to switch statements. For example: (snippet from cppreference.com)
std::variant<int, long, double, std::strin...
Perithecium asked 16/8, 2017 at 7:45
1
What do we have?
A software system we are working on needs to exchange lots of data between components. The data is structured in what we call trees of variables. This data essentially is the inter...
Respiratory asked 2/10, 2020 at 17:30
2
Solved
When implementing the Visitor Pattern, is it a bad idea to add additional parameters to the Accept and Visit methods? I have never seen any examples that do this but no mention of it being a bad id...
Underwaist asked 6/5, 2014 at 9:59
1
Solved
I'm trying to experiment with making a visitor with just a simple class, with overloads of operator() for each type in the variant.
I expected this to work (as it's how I assumed it worked fo...
Stoichiometry asked 6/10, 2020 at 13:31
1
Solved
I just bounced into something subtle in the vicinity of std::visit and std::function that baffles me. I'm not alone, but the only other folks I could find did the "workaround and move on" dance, an...
Unpleasant asked 15/6, 2020 at 19:29
5
In the post
When should I use the Visitor Design Pattern? the first answerer states :
Now we want to add a new operation to the hierarchy, namely we want
each animal to make its sound. As far as t...
Idzik asked 31/10, 2015 at 21:43
0
We've recently transformed one of our visitors for an object tree-like structure (that is about 40 levels deep) to the async/await pattern because the innermost accept methods now perform wor...
Hydrastinine asked 8/4, 2020 at 13:44
2
From https://en.cppreference.com/w/cpp/utility/variant/visit :
what's the return value of visit? I don't understand "selected invocation of visitor"?
The sample code
// Don't understand...
Robertoroberts asked 25/1, 2020 at 1:30
6
I have learned both the patterns but did not understand the differences between these two patterns.
I do not know scenarios, when and where to use these patterns.
Can any one explain the differe...
Aconcagua asked 28/11, 2012 at 13:37
2
Solved
I want to do two replacements in my babel plugin. And second replacement should only happen after first one is done.
module.exports = function(babel) {
const t = babel.types;
return {
visitor: ...
Wylie asked 31/1, 2017 at 12:47
3
Solved
I want to use a visitor given to a more complex function which should inflict changes on a container via the visitor of which is has only general knowledge.
The example is reduced to a minimum. The...
Cyanotype asked 2/6, 2014 at 20:18
1
Solved
I've been recently trying C++17's std::variant and std::visit, and I found it quite powerful.
I specially liked the ability to create a visitor pattern over several variant objects.
Here is one exa...
Graphite asked 21/8, 2019 at 19:41
1
I am working on re-writing the IR of a compiler where both the IR classes and the algorithms are in flux. The current compiler has at least 2 current IRs that are used in different phases that I wa...
Devolution asked 14/5, 2019 at 12:21
5
Solved
here is a simplified implementation of the visitor pattern in C++. Ist it possible to implement something like this in Python?
I need it, because I will pass Objects from C++ code to a function in...
Sized asked 17/9, 2014 at 13:14
3
Solved
From Wikipedia :
The idea was that once completed, the implementation of a class could only be modified to
correct errors; new or changed features would require that a different class be crea...
Rosetterosewall asked 20/12, 2012 at 19:29
3
Solved
I've been trying to reduce the amount of boilerplate in my code, by using C++ Templates to implement the visitor pattern. So far I've come up with this:
class BaseVisitor {
public:
virtual ~BaseV...
Coombs asked 3/8, 2012 at 12:53
4
Solved
I was looking into other questions related to the visitor pattern but couldn't understand the implementation of double dispatch in visitor pattern.
Please refer to the link
Visitor Pattern
How d...
Val asked 20/7, 2011 at 12:54
20
I keep seeing references to the visitor pattern in blogs but I've got to admit, I just don't get it. I read the wikipedia article for the pattern and I understand its mechanics but I'm still ...
Hombre asked 31/10, 2008 at 23:4
1
Solved
I would like to know what is the difference between the Visitor pattern and using a static method to execute code in separation.
Let's take a look at an example where I might call the Visitor patt...
Crescentic asked 29/8, 2018 at 3:2
2
I am looking for a Java x86 disassembler library that should have following features:
Disassembling X86 Code
Describing X86 commands with Java classes and Objects
The command classes should accep...
Maccarthy asked 16/12, 2011 at 8:53
4
Solved
I have following class diagram (visitor pattern implementation):
Expected result:
1) WiredVisitor should visit only Router and WiredNetworkCard
2) WirelessVisitor should visit only Router and ...
Blat asked 10/7, 2012 at 22:56
1 Next >
© 2022 - 2024 — McMap. All rights reserved.