Re: [cpp] 嵌套模板的使用问题

li guojian guojianlee at gmail.com
Wed Dec 6 14:06:40 CST 2006


On 12/6/06, qiaojie <qiaojie at gmail.com> wrote:
> 他这是学Lisp啊
>
>
> 在06-12-6,Chen Shuo <giantchen at gmail.com> 写道:
> > typedef vector<pair<pair<pair<T1, T2>, T3>, T4> >::iterator itePair;
> > 改为:
> > typedef typename vector<pair<pair<pair<T1, T2>, T3>, T4> >::iterator
> itePair;
> >
> > 另外,你为什么不用一个struct,而要用一堆的pair?
> > On 12/6/06, 苏亚 <su1981ya at 163.com> wrote:
> > > 模板中使用嵌套:
> > > template<typename T1, typename T2, typename T3, typename T4>
> > > class InferenceData
> > > {
> > > typedef vector<pair<pair<pair<T1, T2>, T3>, T4> > VecPair;
> > > typedef vector<pair<pair<pair<T1, T2>, T3>, T4> >::iterator itePair;
> > > }
> > >
> > > 编译出错:
> > > type `std::vector<std::pair<std::pair<std::pair<_T1,
> _T2>, T3>, T4>,
> > > std::allocator<std::pair<std::pair<std::pair<_T1, _T2>,
> T3>, T4> > >' is
> > > not derived from type `InferenceData<T1, T2, T3, T4>'
> > >
> > > 不知什么问题?
> > >
> > > _______________________________________________
> > > Cpp mailing list
> > > Cpp at codingnow.com
> > > http://codingnow.com/mailman/listinfo/cpp
> > >
> >
> > _______________________________________________
> > Cpp mailing list
> > Cpp at codingnow.com
> > http://codingnow.com/mailman/listinfo/cpp
> >
>
>
> _______________________________________________
> Cpp mailing list
> Cpp at codingnow.com
> http://codingnow.com/mailman/listinfo/cpp
>
>
这样定义是不合理。但出现这个问题的原因是什么呢?
高手请指点



More information about the Cpp mailing list