vector containing pointers to another vector

This is a discussion on vector containing pointers to another vector within the C++ Programming forums, part of the General Programming Boards category; Here's is what I have. I'm not sure of how to create a new vector containing pointers to people. Code: ...

  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    4

    vector containing pointers to another vector

    Here's is what I have. I'm not sure of how to create a new vector containing pointers to people.
    Code:
    void FilterByBirthMonth( vector<Person*> &people ) 
    {
    	int month = 2;
    	for(size_t i = 0; i < people.size();i++)
    	{
    		
    			if(people[i]->birthDay.getMonth() == month) 
    			{
                             //need new vector here
    			}
    
    	}
    }
    Create a new vector containing pointers to people.

    Loop through the existing people vector and, if the person in the vector
    has the birth month specified by the user, add the person to the new
    vector.

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,164
    Do you know how to populate any vector?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Move To Point
    By Aparavoid in forum Game Programming
    Replies: 8
    Last Post: 02-13-2010, 12:08 PM
  2. C programing
    By flame82 in forum C Programming
    Replies: 2
    Last Post: 05-07-2008, 02:35 PM
  3. How can i made vectors measuring program in DevC++
    By flame82 in forum C Programming
    Replies: 1
    Last Post: 05-07-2008, 02:05 PM
  4. syntax help?
    By scoobygoo in forum C++ Programming
    Replies: 1
    Last Post: 08-07-2007, 10:38 AM
  5. Velocity vector troubles
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 01-18-2005, 10:40 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21