Hello, Mike, i m really appreciate that , i m using double visit; with double variant , variant_ptr_solid -> variante_ptr_behavior and it work very well.
@MikeShah3 ай бұрын
Cheers!
@machinelearning46119 күн бұрын
very well explained
@MikeShah9 күн бұрын
Cheers!
@Chupe_chupe10 ай бұрын
Great video
@MikeShah10 ай бұрын
Cheers!
@bsdooby10 ай бұрын
Are the previous examples and this functional-style one really the same? IMHO the actors act on some target objects (the orcs, goblins), and actors are not the state bearers, but the actions that change the state of bespoke objects (?)
@MikeShah10 ай бұрын
I probably prefer the previous example as it's easier for me to see where the state holds. That said, we could put the attributes, and have an 'id' in the any of the 'actor types' (which could still be derived types) to access any state that we need. But yes, we're effectively using the variant as a 'target', and can dynamically select the state. I think variant might actuallyl be very useful in a game-like scenario for swapping behaviors for objects in the same hierarchy very quickly -- haven't tried in actual game scenario though with this implementation.
@bsdooby10 ай бұрын
@@MikeShah would be interesting to compare performance given that variant type, in a hot loop
@MikeShah10 ай бұрын
Agreed!@@bsdooby
@ami6packs8 ай бұрын
@@bsdooby std::variant is faster than classical visitor pattern using virtual.