Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1035419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:32:22+00:00 2026-05-16T14:32:22+00:00

I have code similar to the following in a header file: template<class A> class

  • 0

I have code similar to the following in a header file:

template<class A>
class List {
  private:
    QVector<A> _list;
};

where QVector is the standard QT container.

When I try to make a variable of type List as a member variable in another header file like this:

class Model {
  private:
    List<int *> the_list;
};

I get the following error:

In instantiation of 'List<int *>':
instantiated from here
error: 'List<A>::_list' has incomplete type

Basically, I want a custom list that is templatized that uses an internal QVector to store the data items.

I assume that my syntax is a little off, so any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:32:23+00:00Added an answer on May 16, 2026 at 2:32 pm

    Make sure you have #included the header file for QVector before your declaration of class List { }. If you omit it then QVector is an undefined type but because List is a templated class the compiler doesn’t omit an error message until you instantiate List for the first time.

    #include <QVector>
    
    template<class A>
    class List {
      private:
        QVector<A> _list;
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have code similar to the following. using (MyEntities context = new MyEntities()) {
I have following code: inline bool match(const std::wstring & text1, const std::wstring & text2)
I am trying to implement a similar effect like the iPhone-alike sliding header in
This may be a similar question to Linker errors 2005 and 1169 (multiply defined
After working with many CMSes and cutting up many HTML designs, when I saw
I am developing a REST API using MVC2. When handling a POST request in
After a bit of investigation, I found that C++0x stores the elements in a
I'm trying to implement functionality to cache certain pages depending on the host. This
As the title says I am wondering if it is possible to loop through
I'm having a hard time choosing whether I should enforce a condition or assert

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.