vendredi 16 novembre 2018

What is an adaptors in the C++ standard? How does it relate to the adapter design pattern?

The C++ standard uses the word adaptors several times:

  • Allocator adaptors (std::scoped_allocator_adaptor)
  • Container adaptors (std::queue, std::priority_queue, std::stack)
  • Iterator adaptors (std::reverse_iterator, std::move_iterator)

It does not seem that the word itself is defined in the standard. I was thinking that the word was used in reference to design patterns, but it seems that in the adapter design pattern, the adapter should only adapt the interface, not the behavior.

Questions: Therefore I was wondering:

  • What would be the approximate definition of an adaptor in the C++ standard?
  • Does it correspond to the adapter design pattern?
  • If not, what would be the design pattern that matches the best what an adaptor is in the C++ standard (adapter, proxy, facade, decorator...)?

Aucun commentaire:

Enregistrer un commentaire