討論串[分享] typedef dereference of a type
共 5 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者kevingwn (如雲如風的人生)時間15年前 (2011/01/17 12:57), 編輯資訊
0
0
0
內容預覽:
有點好奇,一般不是都寫成. struct Foo. {. template<class A>. A operator()(A &a). {. return a + 1; // for example. }. };. IterType it;. Foo()(*it);. 上面這樣嗎?. 可以請教什麼時

推噓0(0推 0噓 5→)留言5則,0人參與, 最新作者adxis (Acquire higher)時間15年前 (2011/01/01 23:50), 編輯資訊
0
0
0
內容預覽:
不是很了解這一行的意思,用gcc 4.5 測試也編不過. 還是 y大 的意思是像下面這樣?. template< typename IterType>. struct deref {. typedef decltype(*IterType()) ValueType;. };. 這樣在 default

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者DirkC (Dirk)時間15年前 (2010/12/31 20:51), 編輯資訊
0
0
1
內容預覽:
謝謝提醒 :). 參考STL的作法小改一下,應可符合原po需要:. #include <iostream>. #include <string>. using namespace std;. template <typename T>. struct Foo {. typedef T ValueTy
(還有396個字)

推噓5(5推 0噓 2→)留言7則,0人參與, 最新作者littleshan (我要加入劍道社!)時間15年前 (2010/12/31 11:15), 編輯資訊
0
0
1
內容預覽:
http://www.cplusplus.com/reference/std/iterator/iterator_traits/. 所以這樣寫就可以了. template < typename IterType >. class Foo {. typedef typename std::iterat
(還有207個字)

推噓8(8推 0噓 6→)留言14則,0人參與, 最新作者yoco315 (眠月)時間15年前 (2010/12/31 02:28), 編輯資訊
0
0
0
內容預覽:
最近寫個東西,遇到一個需求,. template < typename IterType >. class Foo {. typename ??? ValueType ;. } ;. 就是我希望當使用者 class Foo<int*> 的話,. class Foo<int*>::ValueType
(還有1397個字)
首頁
上一頁
1
下一頁
尾頁