开发者

GCC issue with template

开发者 https://www.devze.com 2023-03-05 02:32 出处:网络
I want to use the below garbage collector, but when I would compile I get a lot of error with GCC but not with VSC++, i.e this.

I want to use the below garbage collector, but when I would compile I get a lot of error with GCC but not with VSC++, i.e this.

list<GCInfo<T> >::iterator开发者_高级运维 p; ---> Expected ';' after expression

And here is the library.

http://www.devarticles.com/c/a/Cplusplus/A-Simple-Garbage-Collector-for-C-plus-plus/3/


Assuming T is a template parameter, you need a typename:

typename list<GCInfo<T> >::iterator p;
^^^^^^^^

For more about when and why typename is required, see the Stack Overflow C++ FAQ "Where and why do I have to put template and typename on dependent names?"

0

精彩评论

暂无评论...
验证码 换一张
取 消