最近迷上了STL库。。一边使用一边trace它的源代码,可是发现了一个问题是关于allocator中的rebind,其定义如下:template 
class allocator 
: public _Allocator_base<_Ty> 

//....other code... 
template 
struct rebind 
{ // convert an allocator<_Ty> to an allocator <_Other> 
typedef allocator<_Other> other; 
}; 
//....other code... 
}; 
而在使用的时候的写法如下: 
typename _Alloc::template rebind<_Node>::other _Alnod; typename是为了使用struct rebind存在,那么中间那个template呢?为什么要加那个template?从bnf分析的角度来看,似乎也无法解释它的存在我用的是VS.net2003,而我把这个问题交给我的数据结构老师后,他说他也无法说明这个问题,不过他说sgi等其他的STL中没有这样的用法,但VC++.Net中到处都是
请各路高手赐教。。

解决方案 »

  1.   

    我也不会,但看到了你的问题也正好是我的问题,如果你知道答案你告诉我一下好吗?我还有个问题:vc++怎样调用pro/e图呢?我现在正在研究储存格式.是不是vc++能够调用stl格式的三维图,而pro/e也能储存成stl格式!!!我想这之间是不是有一些联系!!如果你明白可以告诉我怎么做吗?真心和你成为学习上的朋友!!! (即vc学习者)希望你能来信!!!
      

  2.   

    pro/e我不太熟,不过我想你所说的stl似乎不是我说的那个。。我指的是Standard Template Libraries,你所说的是pro/e的储存文件后缀吧?