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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:42:24+00:00 2026-06-08T16:42:24+00:00

I just has a vector like that vector<User*> users; I know it is not

  • 0

I just has a vector like that

vector<User*> users;

I know it is not a good programming style…

now I have a function

vector<User> getAllUser(void)
{
}

What I had tried is

vector<User> getAllUser(void)
{
    vector<User> result;
    for (vector<User*>::iterator it = users.begin(); it != users.end(); it++)
    {
        result.push_back(**it);
    }
    return result;
}

But it didn’t work.

Could someone to help me? Thankyou very much. I am just a beginner to STL

  • 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-06-08T16:42:25+00:00Added an answer on June 8, 2026 at 4:42 pm

    You code should work, but you made a typo:

    result.push_bach(**it);
    

    push_bach is not a declared function for std::vector, so I’m assuming that’s where the error lies. I would recommend you get a decent compiler, which should point this error out to you right away, without having to go through stackoverflow.

    To fix, use the proper method name, push_back instead:

    result.push_back(**it);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very simple Mac Cocoa app that just has a Web View
I have a file that contains java serialized objects like Vector. I have stored
I often have classes that are mostly just wrappers around some STL container, like
I have a need for a container that acts like the following. It has
If I have a std::vector buffer that has room for 100 characters and I
I have a class that has a vector of another class objects as a
Say you have a vector class that has a template length and type -
Here's a problem I've had recently that just HAS to be a common pain
I have a IEnumerable. I have a custom Interval class which just has two
When I have this, the div, which just has text in it, uses all

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.