Patterns repository contains design patterns sample implementations from various sources like DPiM, GmPP and others ...
We used SCons software construction tool so building samples is easy, just fire
scons -j8
command from patterns directory and you're done.
Creational, structural and behaviour classic GoF design patterns.
flyweight.cpp
: custom flyweight (user
class) design pattern implementation compared with boost::flyweight
(user2
class) implementation from DPiM, chapter 11
flyweight_tiles.cpp
: Tile based world implented using flyweight design pattern (bare pointer without any magic) from GmPP, chapter 3. There are three basic implementations there 1) enum based (tile_enum
and tile_byte
), 2) object based (tile_field
) and 3) object hierarchy based (tile_virtual
).
flyweight_forest.cpp
: Tree representation for forest renderer flyweight design pattern sample from GmPP, chapter 3. Class heavy_tree::tree
splited into to classes split_tree::tree_model
and split_tree::tree
where tree_mode
it is our flyweight.
TODO: Add more samples from flyweight examples.
lazybitmap.cpp
: lazy loaded bitmap as a sample for (virtual) proxy design pattern from DPiM, chapter 12
simple_builder.cpp
: simple builder design pattern implementation from DPiM, chapter 2, pg. 28
groovy_style_builder.cpp
: groovy style DSL like builder design patter implementation from DPiM, chapter 2, pg. 30
composite_builder.cpp
: multiple composition builder design pattern implementation from DPiM, chapter 2, pg. 31
board_game.cpp
: generic board game algorithm and inheritance based chess implementation as sample for template method design pattern from DPiM, chapter 23
operation_solver.cpp
: math, list operation solving algorithm sample implemented using template method design pattern
for now all non GoF patterns from GmPP ...
Adam Hlavatovič