Decorator pattern[1] tricks to reduce queue dependency
TL;DR this one simple trick for static member initialization in a class template[2].
The original rather dumb enqueuer and dequeuer used the shared_queue class to track their counts and close the underlying queue accordingly. Giving them each their own static count makes the shared_queue wrapper redundant and usage more intuitive, but how to initialise the static variable was a brief head scratcher...
Smart dequeuer decorator:
References:
[1] http://en.wikipedia.org/wiki/Decorator_pattern
[2] static member initialization in a class template
No comments:
Post a Comment