Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ insert into map

map<float, float> map1;

//using insert function
map1.insert({ 56.4, 67.2 });

//Using Emplace Function, it increases the size of the map by 1
map2.emplace(3, 78.4);

//using subscript [], it also increases the size of the map by 1
//it always assigns a Null value if a value is not mapped to our key
map3['x'] = 54.3; //x is key
 
PREVIOUS NEXT
Tagged: #insert #map
ADD COMMENT
Topic
Name
8+3 =