Use of standard library and template nesting in GCC (the template iterator cannot be identified)

Source: Internet
Author: User
Template <class T>
Inline static void dumpvector (const STD: vector <t *> & vvector)
{
STD: vector <t * >:: iterator pvectorit = vvector. Begin ();
For (; pvectorit! = Vvector. End (); pvectorit ++)
{
(* Pvectorit)-> dump ();
}
}

The above statement in VC can be passed. When using the template iterator in GCC, a compilation error occurs. It seems that the type does not match, but the iterator prototype is not used directly. As follows:

Template <class T>
Inline static void dumpvector (const STD: vector <t *> & vvector)
{
_ Gnu_cxx ::__ normal_iterator <t * const *, STD: vector <t *, STD: Allocator <t *> pvectorit = vvector. Begin ();
For (; pvectorit! = Vvector. End (); pvectorit ++)
{
(* Pvectorit)-> dump ();
}
}

The specific reason is unknown. I think it is because the macro definition does not contain the corresponding macro definition, or the macro definition does not support the template. I will study it later. Pai_^

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.