久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

C++ 模板元編程的最佳介紹?

Best introduction to C++ template metaprogramming?(C++ 模板元編程的最佳介紹?)
本文介紹了C++ 模板元編程的最佳介紹?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

靜態元編程(又名模板元編程")是一種很棒的 C++ 技術,它允許在編譯時執行程序.當我讀到這個規范的元編程示例時,我的腦子里突然亮了起來:

Static metaprogramming (aka "template metaprogramming") is a great C++ technique that allows the execution of programs at compile-time. A light bulb went off in my head as soon as I read this canonical metaprogramming example:

#include <iostream>
using namespace std;

template< int n >
struct factorial { enum { ret = factorial< n - 1 >::ret * n }; };

template<>
struct factorial< 0 > { enum { ret = 1 }; };

int main() {
    cout << "7! = " << factorial< 7 >::ret << endl; // 5040
    return 0;
}

如果想了解更多關于 C++ 靜態元編程的知識,最好的來源是什么(書籍、網站、在線課件等)?

If one wants to learn more about C++ static metaprogramming, what are the best sources (books, websites, on-line courseware, whatever)?

推薦答案

[回答我自己的問題]

到目前為止,我發現的最好的介紹是第 10 章C++ 中的靜態元編程",來自生成式編程、方法、工具和應用程序,作者是 Krzysztof Czarnecki 和 Ulrich W. Eisenecker,ISBN-13:9780201309775;和第 17 章元程序",C++ 模板:完整指南 作者:David Vandevoorder 和 Nicolai M. Josuttis,ISBN-13:9780201734843.

The best introductions I've found so far are chapter 10, "Static Metaprogramming in C++" from Generative Programming, Methods, Tools, and Applications by Krzysztof Czarnecki and Ulrich W. Eisenecker, ISBN-13: 9780201309775; and chapter 17, "Metaprograms" of C++ Templates: The Complete Guide by David Vandevoorder and Nicolai M. Josuttis, ISBN-13: 9780201734843.

Todd Veldhuizen 有一個很棒的教程這里.

Todd Veldhuizen has an excellent tutorial here.

一般來說,C++ 編程的一個很好的資源是Modern C++ Design,作者是 Andrei Alexandrescu,ISBN-13:9780201704310.這本書混合了一些元編程和其他模板技術.對于元編程,請參見第 2.1 節編譯時斷言"、2.4將積分常量映射到類型"、2.6類型選擇"、2.7在編譯時檢測可轉換性和繼承性"、2.9NullType 和 EmptyType" 和 2.10 類型特征".

A good resource for C++ programming in general is Modern C++ Design by Andrei Alexandrescu, ISBN-13: 9780201704310. This book mixes a bit of metaprogramming with other template techniques. For metaprogramming in particular, see sections 2.1 "Compile-Time Assertions", 2.4 "Mapping Integral Constants to Types", 2.6 "Type Selection", 2.7 "Detecting Convertibility and Inheritance at Compile Time", 2.9 "NullType and EmptyType" and 2.10 "Type Traits".

我發現的最好的中級/高級資源是 C++ 模板元編程,作者是 David Abrahams 和 Aleksey Gurtovoy,ISBN-13:9780321227256

The best intermediate/advanced resource I've found is C++ Template Metaprogramming by David Abrahams and Aleksey Gurtovoy, ISBN-13: 9780321227256

如果您只喜歡一本書,請獲取C++ 模板:完整指南,因為它也是一般模板的權威參考.

If you'd prefer just one book, get C++ Templates: The Complete Guide since it is also the definitive reference for templates in general.

這篇關于C++ 模板元編程的最佳介紹?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Difference between std::reference_wrapper and simple pointer?(std::reference_wrapper 和簡單指針的區別?)
Difference between const. pointer and reference?(常量之間的區別.指針和引用?)
How to access the contents of a vector from a pointer to the vector in C++?(c++ - 如何從指向向量的指針訪問向量的內容?)
Meaning of *amp; and **amp; in C++(*amp; 的含義和**amp;在 C++ 中)
Why can#39;t I do polymorphism with normal variables?(為什么我不能對普通變量進行多態?)
Dereferencing deleted pointers always result in an Access Violation?(取消引用已刪除的指針總是會導致訪問沖突?)
主站蜘蛛池模板: 亚洲视频免费在线观看 | 久久不卡| av一二三区 | 久久精品电影 | 一区二区三区国产视频 | 国产欧美一区二区三区另类精品 | 国产成人在线免费 | 亚洲精品久久久久久久不卡四虎 | 亚洲成色777777在线观看影院 | 亚洲三区视频 | 99国产精品一区二区三区 | 久久国内 | 日韩精品免费 | 欧美日韩亚洲国产综合 | 久久国内精品 | 久久国产精99精产国高潮 | 视频一区二区在线观看 | 在线一区视频 | 国产精品久久久亚洲 | 欧美一区二区三区一在线观看 | 亚洲444eee在线观看 | 男女下面一进一出网站 | 在线播放国产一区二区三区 | 一区二区免费在线视频 | 18性欧美| 精品一区二区在线看 | 国产91丝袜在线熟 | 69性欧美高清影院 | 日韩小视频在线 | 久久久久九九九女人毛片 | 视频一区二区三区中文字幕 | 成人欧美日韩一区二区三区 | 一区二区三区四区毛片 | 中文字幕在线第一页 | 日日操操操 | 免费黄色av网站 | 黄色毛片在线播放 | 91久久国产精品 | 久久久久久亚洲精品 | 精品久久1| 色综久久|