O'Reilly logo

Design Patterns in Modern C++: Reusable Approaches for Object-Oriented Software Design by Dmitri Nesteruk

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Dmitri Nesteruk 2018

Dmitri Nesteruk, Design Patterns in Modern C++, https://doi.org/10.1007/978-1-4842-3603-1_22

22. Strategy

Dmitri Nesteruk

(1)St. Petersburg, Russia

Suppose you decide to take an array or vector of several strings and output them as a list,

  • just

  • like

  • this

If you think about the different output formats, you probably know that you need to take each element and output it with some additional markup. But in the case of languages such as HTML or LaTeX , the list will also need the start and end tags or markers. The processing of lists in either of these formats is at the same time similar (you need to output each item) and different (the way the items are output). Each of these can be handled with a separate Strategy.

We can formulate ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required