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 6970285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:41:25+00:00 2026-05-27T16:41:25+00:00

I’m new with vectors. I’m trying to add objects to a vector. But the

  • 0

I’m new with vectors. I’m trying to add objects to a vector. But the program can’t compile because I have a problem in the code. But I don’t know what is it. The error is:

error C2664: 'void std::vector<_Ty>::push_back(_Ty &&)' : cannot convert parameter 1 from 'Line (void)' to 'Line &&'

The code is:

Line help_line ();
cin >> ln_quan;
vector <Line> figure_line;
for (int i = 0 ; i < ln_quan ; i++)
{
    figure_line.push_back(help_line);
}

The compiler says that the error is at the 6-th line (figure_line.push_back(help_line);).

I gave up trying to find a tutorial explaining how to add objects (I give up easily when doing such things…).

And what does ‘Line (void)’ and ‘Line &&’ mean? Is ‘Line (void)’ the class ‘Line’? If so, what does ‘(void)’ mean in this case?

  • 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-27T16:41:26+00:00Added an answer on May 27, 2026 at 4:41 pm
    Line help_line ();
    

    This does not mean “help_line shall be an instance of Line created with the default constructor”. It means “help_line shall be a function, implemented somewhere else, that takes no arguments and returns a Line instance”.

    The thing you want is spelled Line help_line;, with no parentheses.

    So, you get the following error message:

    'void std::vector<_Ty>::push_back(_Ty &&)' : cannot convert parameter 1 from 'Line (void)' to 'Line &&'
    

    Line && is the kind of parameter that push_back is expecting. The && doesn’t really matter here; it’s best thought of, for beginners, as a kind of calling convention. You’re still just passing a Line, because that’s the kind of thing you collect in a vector of Lines.

    Line(void) is “the type of functions that take no arguments and return a Line instance”. (void) is another way to write (), for function arguments (it is discouraged in new code, but sometimes needed when interacting with very old C code).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am trying to loop through a bunch of documents I have to put
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and

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.