Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

pass map as reference c++

#include<map>

void function2(std::map<int, int> &temp_map); //forward declaration

void function1(){
    std::map<int, int>  my_map; //automatic variable 
                                //no need to make it pointer!
    function2(my_map); 
}

void function2(std::map<int, int> &temp_map){
    //do stuff with the map
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pass #map #reference
ADD COMMENT
Topic
Name
8+6 =