Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

design patterns used in STL(standard template library)

I am learning STL and design patterns . i wanted to know is there any document or link that explains how design patterns are implemented in STL i did the google but not able to get much data

like image 860
anish Avatar asked Apr 23 '10 12:04

anish


1 Answers

I hope you mean, "which design patterns can be identified in the STL".

The STL stack is a container adapter. An adapter is a design pattern. The iterator is also a design pattern. The STL function objects are related to the command pattern.

Patterns:

  1. Adapter (container adapters)
    • stack
    • queues
    • priority queues
  2. Iterator
  3. Command + Adapter (function adapters)
  4. Iterator + Adapter (iterator adapters)
    • reverse iterators
    • insert iterators
    • stream iterators
  5. Template Method (STL algorithms using user-specified functions)
  6. Which creational pattern? (Allocators)

The way these patterns are implemented is very different from the way they are implemented in an object oriented design. Josuttis wrote "the STL concept contradicts the original idea of object-oriented programming". This is what is causing the confusion around your question.

like image 165
7 revs Avatar answered Sep 23 '22 00:09

7 revs