C ++ uses the latest two-volume combination version. Therefore, the page number corresponds to the book.
Chapter 16 of the first and Chapter 5 lecture templates of the second. The former is relatively basic. The latter includes almost everything in the template.
The difference between this book and C ++ primer is that the explanations are continuous and complete.Source code. C ++ primer is like a list of knowledge points (at least this chapter on generics is like this, and it seems a little sudden ). I read a considerable part of programming ideas yesterday and went back to primer to finally understand what it meant.
Before looking at the generics, I flipped through the Directory and checked the Union chapter. We can see Chapter 3 from page 94. I have read about Enum, union, Debugging techniques, and function addresses.Article. The description of make is also complete. I did not take it into detail.
The two volumesCodeAlmost all of them have been implemented once, which is very useful for explanations.
Enter the body:
Chapter 16: Comparison Basics
Chapter 2: in-depth understanding of the template
Template parameters: No type template parameters (size_t), default template parameters (similar to the default parameters of the function, very important, traits used), template parameters
Typename: if a type in a template code is limited by template parameters, typename must be used as the prefix declaration. Otherwise, the compiler does not know that this is a type.
Member template: function or class
The member template function cannot be virtual. Because when parsing a class, you need to know the location of the virtual function.
P600 template Specialization
P602 template half-exclusive: this means that there is at least one method for some methods of template specialization, and its template parameters are "open.
ADL: Search for association parameters. It looks a bit mysterious. Next Review. The p612 code implements different results on VC ++ 2010 than on the book. But it is probably the cause of the compiler. But it does not work to learn this thing changed by the compiler. However, Microsoft may not keep its own standards. Next time.
Traits is an implementation method that binds all declarations associated with a certain type. P620 is a good example.
The association between guests and food in P621 is achieved through a basic (empty) Feature Template. (The default template parameters are used here)
The example of the unique recursive pattern of the p624 template is clever.
Template metaprogramming:
Compile-time programming (the results may be known before running, read the example)
Expression template
Chapter 6 and Chapter 7 are examples of using the STL template.
Chapter 2 GeneralAlgorithmAt first glance, it is a bit difficult. A little strange .. (You may have read too much today. Continue the next day)
It is very important that the function object concept p648
P650 bind2nd can be used with function objects to view related documents.
Resume the operation on another day ..