"C ++ Template Metaprogramming" Decoction - Classic after classics

xiaoxiao2021-03-06  78

- Write another classic book in history in the history of C books

Liu Weipeng / article

C book boundaries are silent!

At least, that's what I think. I was experiencing the first batch of C classic books in China. I feel really "suddenly like a spring breeze, thousands of trees and pears." Don't misunderstand, I said this first batch of "C Programming Language" "C Primer" classic classic. But that such "Exceptional C " "More Exceptional C " "Effective & More Effective C " "C Gotchas" "Generic Programming and the STL" "The C Standard Library" "C Templates" "Morden C Design" and so on. "Modern C Design" is the most exciting work. Panfro not read the work, it is as if the algorithm is not reading D.E's "The Art of Compute Programming Vol.

1.2.3 "The same, it is impossible to reach a higher realm. I only remember that I got this book from the morning, I saw 22 o'clock in the morning, and I didn't eat it in two meals. Because this book is too classic, it is too predecessor, so I have done a conclusion in my heart. "The C books will have no such exciting work for a long time." Sure enough, some such as "Accelerate C " "Applied C " "C NetWork Programming Vol.1.2", although it is also entered into the classic, but it is not very exciting.

However, the development of C generic technology has not stopped at a moment. The continuous update of the Boost library will gradually promote C generic technology to a new peak. It is originally in the "MODERN C Design" some of the advanced college's technology to The BOOST library has finally combined with practice together. The extensive abstraction of the generic extension has played an amazing force, so the Boost Luti has another highly reused and customized generic components. The generic will finally get closer to programmers through the Boost library.

If the C generic is the grandson who is only pressed in the five-way mountain, "Modern C Design" unveiled the seal on the hill, release the amazing power of this monkey, and the Boost library is the head of Sun Wukong. Gold hoops, constraints and guide it to go in the right direction, do the right thing. Although there is this golden hoop, its power has not weakened at all, even stronger, but it is increasingly mature while being grinded.

However, unfortunately, although the Boost library can be seen everywhere, it can be said to be a source textbook, just as Linux source code and programmer, but "there is no three or two, don't think about Liangshan", not every Individuals can read their source code, and even a programmer that is quite understanding of generics will be difficult to return. This is because the Boost library has made a lot of Workaround in order to save the code in most mainstream compilers, and in order to save the code, the Boost library can be seen everywhere macro, these macros are like maze, source code maze. These two reasons make Boost's source code readability is poor.

Therefore, although the Boost library is close to the programmer, the source code of the Boost library is more and more away from the programmer.

However, in the C generic field, I have been in the room, and I want to go further, and a glimmer is not to read like Boost's classic source code. "300 familiar reading Tang poems, will not be poetry." Although the readability of the BOOST library is more readable, it is not very poor. If someone explains the generic use and design concept in the Boost library in advance, I believe that you will be more excited when you read.

This is the upcoming classic, one of the Boost's initiators, members of the C Standards Committee, David Abraham, and another Boost member Aleksey Gurtovoy - "C Template Metaprogramming: Concepts, Tools And techniques from boost and beyond.

I am bound to be a classic book for such a potential, I am really awkward, or refer to a paragraph of the homepage:

This book tells the C template programming book will give C user unprecedented powerful power and make this technology a truly practical technology in the hands of programmers.

This book covers C Template Metaprogramming in a way that provides unprecedented capability to the C power-user, and delivers practical metaprogramming into the hands of the everyday programmer.

All along, C generics seems to always be a strange location, some people say that it is too far away, some people think that it is too far away, and now I don't use it. Some people think that it is the designer of the library, and the programmer relationship Not big. More people hold the attitude of "not dare to climb". In fact, these are wrong attitudes, and the generic is a long-awaited idea, and its core concept is abstraction, and there is no mystery. Compared to object-oriented binary multiplexing, generic code provides the source level multiplexing, a stronger dynamic characteristic, a stronger type security and efficiency, both complement to maximum strength . A lot of classic books that have been published on C generic books are actually a good introduction. Just, about C generics, there is also a technology-template programming that can be independent. This is precisely a technique that makes generic components more expressive and freedom. It can even be said to be one of the cornerstones of the Boost library (except for the exquisite components such as regex dependence). Therefore, it is obvious that this is a very important technology, which can also be seen from the book "Generative Programming".

However, for this technology can be independent, we are currently just some sporadic descriptions, "C Templates" is there a whole chapter describes Metaprogram, but it can not be happy for the thirsty of the knowledge. However, this situation has passed, "C Template Metaprogramming" will tell the system C template programming technology, and this original is just the mysterious technology of the tool in the hands of the masters to ordinary programmer, give ordinary procedures Amazing power.

If "Modern C Design" is the classic of C generic books (it is indeed), then this is about to be "C Template Metaprogramming" will be another classic after the classic!

The author has opened the third chapter and Appendix A of the book. Although there is only two chapters, it is absolutely worth reading. Here is my translation, one is for your own interest, the second is to facilitate the reader. Chapter III Depth Exploration Element

http://blog.9cbs.net/pongba/archive/2004/09/01/90642.aspx

转载请注明原文地址:https://www.9cbs.com/read-121359.html

New Post(0)