首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

关于模板的有关问题,高手请解答

2012-02-25 
关于模板的问题,高手请解答有几句话我都不太懂,请问该如何理解呢?请问C++能去学习这些语法(模板)高级应用

关于模板的问题,高手请解答
有几句话我都不太懂,请问该如何理解呢?
请问C++能去学习这些语法(模板)高级应用的书有哪些呢?

struct _pt
{
typedef const T1& T;
};

template<class T1>
struct _pt<T1 &>
{
typedef T1 T;
};
这两句话是将非引用的类转换为引用的类,但是是如何翻译的...我有点无法搞懂其中的逻辑

还有,请问这几句话如何理解呢?

template<class _FT>
struct fp;
template<class _RT>
struct fp<_RT()>
{
enum {narg = 0};
typedef _RT ret_type;
};
template<class _RT, class _AT0>
struct fp<_RT(_AT0)>
{
enum {narg = 1};
typedef _RT ret_type;
typedef _AT0 arg0_type;
typedef typename pt<arg0_type>::T rarg0_type;
};
最近看了些模板的东西,看不太懂。
不知道该如何学习这些高级语法呢?

[解决办法]
《modern c++ design》
《c++ templates》
《stl 源码剖析》
《产生式编程——方法、工具与应用》
《c++ template metaprogramming》

热点排行