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

對于嵌套模板,`>>` 何時成為標準 C+

For nested templates, when did `gt;gt;` become standard C++ (instead of `gt; gt;`)?(對于嵌套模板,`gt;gt;` 何時成為標準 C++(而不是`gt; gt;`)?)
本文介紹了對于嵌套模板,`>>` 何時成為標準 C++(而不是`> >`)?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我似乎記得,在過去,在處理嵌套模板參數時被警告不要將兩個 > 字符放在彼此旁邊(沒有空格).我什至依稀記得聲明了向量的向量并遇到了這個編譯錯誤.

I seem to recall, in times of yore, being warned against putting two > characters right next to each other (without a space) when dealing with nested template parameters. I even vaguely remember declaring vectors of vectors of whatever and encountering this compilation error.

但現在我發現編譯可怕的>>...

But now I find that there is absolutely nothing wrong with compiling the dreaded >>...

我的問題是:

這個約定在什么時候成為可以接受的做法?

At what point did this convention become an acceptable practice?

它是標準 C++ 的一部分嗎?

Is it part of standard C++?

它是否一直是標準的一部分,而我在大學使用的編譯器(以及我的教授)還不支持它?

Was it always part of the standard and the compilers I used (and the professors I had) in college just didn't support it yet?

也許這些問題有點歷史,但對我來說,適當的歷史背景似乎使實際記憶變得微不足道.

Maybe these questions are a tad bit historical, but for me it seems that proper historical context makes actual remembering trivial.

推薦答案

使用嵌套 >>> 關閉的模板是 正式支持 即將推出的標準 C++0x(現在是 C++11).以前,您需要空間或編譯器為您加倍努力(并且做了標準未指明的事情).

Templates closed with nested >> are officially supported by the upcoming standard C++0x (now C++11). Previously you would need the space, or a compiler that went the extra mile for you (and did things not indicated by the standard).

問題源于C中的>>是右移運算符,它是一個單獨的詞法標記,與兩個單獨的>沖突code> 在經典構造的 C++ 編譯器的解析階段需要的標記(并且僅在模板的情況下,而不是在它實際上是右移時).換句話說,>>,如果允許關閉嵌套模板,在詞法上是模棱兩可的,但是這可以(并且正在)在解析過程中通過額外的復雜性來解決(這在現代 C++ 中實際上是沒什么新鮮的).

The issue stems from the fact that >> in C is the right-shift operator, which is a single lexical token, which conflicts with the two separate > tokens that would be needed during the parsing stage in a classically-constructed C++ compiler (and only in the case of templates, not when it actually is a right-shift). In other words, the >>, if allowed to close nested templates, is lexically ambiguous, but this can be (and is being) addressed by extra sophistication during parsing (which in modern C++ is really nothing new).

這篇關于對于嵌套模板,`>>` 何時成為標準 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?(取消引用已刪除的指針總是會導致訪問沖突?)
主站蜘蛛池模板: 男人天堂色 | 精品亚洲一区二区三区 | 91国产精品在线 | 黄色片在线观看网址 | 日韩伦理一区二区 | 久久成人在线视频 | 好姑娘影视在线观看高清 | 久久躁日日躁aaaaxxxx | 色综合色综合色综合 | 国内精品久久久久久久影视简单 | 亚洲人成在线观看 | 亚洲精品一区二区 | 免费黄篇 | 久久久久久成人 | 天天综合网91 | 成人av一区| 午夜a v电影 | 午夜免费电影院 | 人人玩人人添人人澡欧美 | 国产精品一区二区视频 | 久久成人一区 | 欧美日韩综合精品 | 精品视频一区二区三区在线观看 | 一区二区三区免费观看 | 国产精品成人品 | 国产乱码精品一区二区三区五月婷 | 成人免费视频观看视频 | 欧美一级片在线观看 | 亚洲精品不卡 | 欧美激情精品久久久久久变态 | 亚洲高清一区二区三区 | 中文字幕乱码一区二区三区 | 亚洲电影中文字幕 | 欧美精品1区 | 91精品国产欧美一区二区成人 | 国产精品免费在线 | 日韩精品在线一区 | 草久久 | 日韩在线播放视频 | 亚洲性爰 | 国产有码|