11.07.2015 Views

Understanding C++ Expression Templates - Angelika Langer

Understanding C++ Expression Templates - Angelika Langer

Understanding C++ Expression Templates - Angelika Langer

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

38Policy Specifications! classic quick sort function from C library– uses function pointer for sorting criterionvoid qsort( void *base, size_t num, size_t width,int (*compare )(const void *elem1, const void *elem2 ));! sort algorithm from the <strong>C++</strong> library– uses comparitor type (function pointer or function object)templatevoid sort(RandomAccessIteratorfirst,RandomAccessIterator last,Comparator cmp);© Copyright 1995-2000 by <strong>Angelika</strong> <strong>Langer</strong>. All Rights Reserved.http://www.<strong>Angelika</strong><strong>Langer</strong>.com(75)last update: 11/7/2005 ,21:37The Strategy PatternThe Strategy pattern (also known as Policy) provides a way toconfigure a class or function (the context) with one of manybehaviors (the strategies).! There is a family of strategies that have a certain interfacein common.! The context uses this interface for implementing itsoperations.Examples:– allocation strategies of a container– sorting order used by a sort algorithm or a sorted collection– synchronization policy of objects© Copyright 1995-2000 by <strong>Angelika</strong> <strong>Langer</strong>. All Rights Reserved.http://www.<strong>Angelika</strong><strong>Langer</strong>.com(77)last update: 11/7/2005 ,21:37

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!