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

模板 typedefs - 你的工作是什么?

Template typedefs - What#39;s your work around?(模板 typedefs - 你的工作是什么?)
本文介紹了模板 typedefs - 你的工作是什么?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

限時(shí)送ChatGPT賬號(hào)..

C++ 0x 具有模板別名(有時(shí)稱為模板 typedef).請(qǐng)參閱此處.C++ 的當(dāng)前規(guī)范沒(méi)有.

C++ 0x has template aliases (sometimes referred to as template typedefs). See here. Current spec of C++ does not.

你喜歡用什么來(lái)解決?容器對(duì)象還是宏?你覺得值得嗎?

What do you like to use as work around ? Container objects or Macros ? Do you feel its worth it ?

推薦答案

你喜歡用什么來(lái)解決?容器對(duì)象還是宏?你覺得值得嗎?

What do you like to use as work around ? Container objects or Macros ? Do you feel its worth it ?

規(guī)范的方法是使用像這樣的元函數(shù):

The canonical way is to use a metafunction like thus:

template <typename T>
struct my_string_map {
    typedef std::map<std::string, T> type;
};

// Invoke:

my_string_map<int>::type my_str_int_map;

這也用于 STL (allocator::rebind) 和許多庫(kù),包括 Boost.我們?cè)谏镄畔?kù)中廣泛使用它.

This is also used in the STL (allocator::rebind<U>) and in many libraries including Boost. We use it extensively in a bioinformatical library.

它很臃腫,但在 99% 的情況下都是最好的選擇.在這里使用宏是不值得的.

It's bloated, but it's the best alternative 99% of the time. Using macros here is not worth the many downsides.

(我修改了代碼以反映 Daniel 在評(píng)論中指出的 Boost/STL 約定.)

( I've amended the code to reflect Boost/STL conventions as pointed out by Daniel in his comment.)

這篇關(guān)于模板 typedefs - 你的工作是什么?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

Difference between std::reference_wrapper and simple pointer?(std::reference_wrapper 和簡(jiǎn)單指針的區(qū)別?)
Difference between const. pointer and reference?(常量之間的區(qū)別.指針和引用?)
How to access the contents of a vector from a pointer to the vector in C++?(c++ - 如何從指向向量的指針訪問(wèn)向量的內(nèi)容?)
Meaning of *amp; and **amp; in C++(*amp; 的含義和**amp;在 C++ 中)
Why can#39;t I do polymorphism with normal variables?(為什么我不能對(duì)普通變量進(jìn)行多態(tài)?)
Dereferencing deleted pointers always result in an Access Violation?(取消引用已刪除的指針總是會(huì)導(dǎo)致訪問(wèn)沖突?)
主站蜘蛛池模板: 黄网免费 | 亚洲国产精品人人爽夜夜爽 | 巨大荫蒂视频欧美另类大 | 成人午夜视频在线观看 | 最新超碰 | 亚州成人 | 国产精品久久国产精品久久 | 免费视频久久 | 精品三级在线观看 | 色久伊人| 久久久久久91香蕉国产 | 国产999在线观看 | 成人综合伊人 | 91影院 | 久久精品一区 | 亚洲v区 | 亚洲欧美一区二区三区1000 | 一级二级三级在线观看 | 欧美成人免费电影 | 超碰成人免费观看 | 免费观看一级特黄欧美大片 | 精品无码久久久久久国产 | 国产精品永久免费观看 | 国产羞羞视频在线观看 | 欧美日韩在线不卡 | 高清一区二区视频 | 成人av免费 | 一区二区三区四区在线播放 | 国产精品一区久久久 | 91在线观看 | 亚洲精品久久久一区二区三区 | 国产高清视频一区 | 亚洲精品免费在线观看 | 午夜羞羞 | 一区中文字幕 | 看一级黄色毛片 | 婷婷在线视频 | 欧美大片一区二区 | 日韩毛片在线观看 | 欧美不卡视频一区发布 | 四虎在线观看 |