Generic programming concept & use

1, concepts:

      Description: Generic programming is actually a program written that he does not rely on specific data types.

      Thought: mainly the specific algorithm peeled from a particular abstract data structures out, so that the algorithm can be common in any type of data, not only the basic data types, custom types.

      Advantages: no need to write when different data types or a vessel operated similar calculation algorithm, when rewriting or modifying different types of templates for extension is not necessary to rewrite a lot of re algorithm function, greatly improved software reusability.

2, use:

     The most common is the use of STL object-oriented programming process, the STL class templates, function templates are designed by the idea of generic programming.

     STL library most often said container library inside the main use of these seven: vector (vector), two-way queue (deque), list (list), the set (set), multiple collections (multiset), maps (map) as well as multiple mappings (multimap).

    Specific reference to the following use of the corresponding sections of these books:

  "C ++ 11/14 Advanced Programming: Boost library Quest"

  "C ++ comments C ++ Annotations"

  "Generic Programming and STL"

Published 23 original articles · won praise 4 · Views 9979

Guess you like

Origin blog.csdn.net/hxp1994/article/details/89944253