Thread: vector containing pointers to another vector

  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をこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    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.

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, 01: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, 11:40 AM