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

  • Home
  • SEARCH
  • 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 7654043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:10:52+00:00 2026-05-31T12:10:52+00:00

Below is my Template matrix which I want to build by taking value from

  • 0

Below is my Template matrix which I want to build by taking value from user.
But when I compile it. I am getting below error. Why the error ?

SO_template.cpp:
In member function void Matrix<T>::BuildMatrix(std::vector<T, std::allocator<_CharT> >)':
SO_template.cpp:44: error: expected
;’ before “it”

If I specialize my class using int it does not complain why?

 template<class T>
  class Matrix
  {
    private:
          vector<T> col;
          int iNumberOfRow;
          int iNumberOfCol;
    public:
     void BuildMatrix(const std::vector<T> stringArray)
     {

         std::vector<T>::iterator it= stringArray.begin();
         cout<<"Build Matrix irow="<<stringArray.size();
         ...
         ...
     }
};
  • 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-31T12:10:53+00:00Added an answer on May 31, 2026 at 12:10 pm

    The issue is that std::vector<T>::iterator is a “dependent type” – the whole type depends on T. Prefix this with typename to fix the issue, so make the line read

    typename std::vector<T>::iterator it= stringArray.begin();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SquareMatrix template class which inherits Matrix template class, like below: SquareMatrix.h:
I am trying to call the below template from my code . But I
Below are lines from the c++ programming language template<class T > T sqrt(T );
The spring JDBC template returns me a list which looks like below: [{CODE_C=CSC, DESC_C=CSC},
I have a class which look likes below: template<typename T> class Set{ public: bool
I want to have something like this below: template <class T> struct Container{ public:
In the template below, user.group is a number and it has to be shown
In template I have two strings which I want to combine in one. {assign
I have a matrix class like below: template <size_t M, size_t N, typename T>
While trying to compile the code below: template <class T> struct scalar_log_minimum { public:

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.