QuoteOriginally posted by: PolterQuoteOriginally posted by: CuchulainnQuoteOriginally posted by: PolterFor more, I'd recommend watching the following:
http://isocpp.org/blog/2013/10/patterns// E.g. consider Strategy (C++11) -- I'd also initially drop the requirement of std::function (read: the requirement of using run-time type erasure) and just take an arbitrary Callable instead (I see no reason to impose the requirement of late / run-time binding without opt-out in general); only use it if you really have to (or it makes important things simpler; e.g., storing std::functions in a container is often the easiest alternative). Design Patterns Are Missing Language Features, so if you're using a language (possibly with accompanying libs) that already has these features, chances are you will need less elaborate workarounds :-)Strategy is intrusive and introduces too much coupling. .NET uses embedded deletgates in classes instead.Right. It seems you're illustrating the RestateTheObvious pattern here (very nice! :]) and/or have missed that the "intrusive & too much coupling" point is exactly the criticism made in the link you're attempting to refer to (apparently without applying the RTFA idiom first--how naughty! :]) -- that's why the C++11 version doesn't use the classical strategy pattern, but an uncoupled implementation thereof (relying on polymorphic function wrappers, occasionally called "delegates" by some).Before getting to design patterns, fancy language features, and whatnot, one may want to keep in mind that basic reading comprehension is useful, too

// On a serious note, I actually mean it: too often I've seen GoF (mis)applied by an apparent copy-paste without any sign of a deeper consideration given beforehand.Stop playing the angry schoolteacher I use delegates/std function to circumvent (GOF) Strategy. If you use that word then it should refer to GOF Stategy pattern (sory I can't listen to all posted videos). _Cal_ it_something_else_. The new style has been known for at least 6-7 years. So, it's also kinda old hat at this stage. Quoteby an apparent copy-paste without Fire him. Gives GOF a bad name. I have also seen many developers who do do it properly. And at the end of the day who are you (and to a lesser extent, I) to pontificate on what developers should or should not adhere to? It's beginning to sound like a mini-religion.Quotepolymorphic function wrappers, occasionally called "delegates" by some).More precisely, delegate is a keyword in .NET. Compare it to Boost signalsTWO