passing std::multimap<int,int> as a function parameter

i am passing an std::multimap<int, int> (a global variable) as a parameter to a function.
In the function itself (function first_rumble() ) the map behaves well..all is ok..size not zero after being filled with some pairs... but after the function call..checking the multimap passed into the function gives me size of zero..as if the multimap was cleared or the function has never been called...
now am gonna paste a code snippet...
I did my very best to present the snippet well so one can understand..the box comments ( /* */) can be ignored.. comments of the sort (//) are a communication to you helpers...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// my headers
   #include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <fstream>
#include <utility>
#include <iterator>
using namespace std;

//some of my global variables
std::vector<int> Tally;
std::vector<int> cross_check, Final_Tally;
std::vector<int> cont;
std::vector<int> cont2;
std::vector<int> values_to_play;
std::multimap<int, int> prob_analysis_1;
std::multimap<int, int> prob_analysis_2;
std::multimap<int, int> prob_analysis_3;

//some functions prototypes
void rolling (int wheel [][20],int rol, int &start, int &limit );
void first_rumble (std::multimap<int, int>);

//part of main
int main ()
{
rolling ( LN, 5, start, limit_3);

std::cout<<" tally here is "<<Tally.size()<<endl<<endl; // check tally size. OK!

first_rumble(prob_analysis_3);

std::cout<<"and after rumble tally is "<<Tally.size()<<endl<<endl; // used to // see if tally was fine

std::cout<<"map size here in main is "<<prob_analysis_3.size()<<endl<<endl; // for checking if map was fine and was NOT ..size was zero...


//infact this range base for didn't produce anything

for (auto ptr : prob_analysis_3)
std::cout<<"map contains :"<<ptr.first<<"---"<<ptr.second<<std::endl<<std::endl;

extract_pos_wins ();
std::cout<<std::endl;


std::cout<<values_to_play.size()<<cout<<endl;

for(auto ptr = values_to_play.begin(); ptr != values_to_play.end(); ptr++)
{
 std::cout<< *ptr<<", ";

}


std::cout<<std::endl;

std::cout<<std::endl<<"row - minus is " <<ROW-Minus<<std::endl;
std::cout<<std::endl<<std::endl<<"THIS IS NO. OF ROWS "<<sizeof (LN) / sizeof (LN[0]);

return 0;
}

//not pasting void rolling because works fine;

//the problem is here between first_rumble and main

void first_rumble (std::multimap<int,int> prob_analysis)
{
// cout<<"Numbers place in order;"<<endl;
 std::sort (Tally.begin(), Tally.end());

  for (int i=0; i<Tally.size(); ) /*note the empty third part of this for loop*/
    {
        int val = Tally[i];

         int  counter = 0;

        while ( Tally[i] == val && i < Tally.size() )
        {
            (counter ++);
             i++;
        }
          if (counter >= guage_start && counter <= guage_end ) // && counter 145 )
              {
                Number_of_cross_check++;
                cross_check.push_back(val);
              }
            
              prob_analysis.insert( std::pair<int,int>(counter, val) ) ;
             // std::cout<<" "<< val<<"  repeated  "<<counter<<"  times!!" ;
    }
   // here in rumble map gave the correct size..so rumble in itself works
    cout<<" size of map rumble end! "<<prob_analysis.size()<<endl<<endl;
    // write_to_file();
//this part also works fine..but in main prob_analysis_3 produces nothing al
/* cout<<endl<<endl<<endl;
   for (auto ptr = prob_analysis.begin(); ptr != prob_analysis.end(); ptr++)
             {   cout<<endl<<endl;
                 cout<<ptr->first<<"==="<<ptr->second;
             }
 cout<<endl;*/



/*cout<<endl<<"Numbers which are in the guage zone are a total of : " <<Number_of_cross_check<<" numbers"<<endl<<endl;
cout<<"These are the numbers in the guage zone ..."<<endl<<endl;

if(cross_check.size() !=0)
   {
     for (int i = 0; i < cross_check.size(); i++)
  std::cout<<std::endl;//cross_check[i]<<" , ";*/
   }
  /*  else
    /* cout<<"There are no numbers which repeated more than 7 times."<<endl;
    * std::cout<<std::endl;

  * cout<<"This is the final countdown=====>>>>>>>>>>>>>>>>"<<endl;

 */
Tally.clear();
Final_Tally.clear();

//again over here the size is consistent..but calling the size of the parameter 
//passed in main gives zero!
cout<<"map size at the end of rumble is "<<prob_analysis.size()<<endl<<endl;

 
}


SO WHERE DID I GO WRONG???
thanks in advance...
void first_rumble (std::multimap<int,int> prob_analysis)

You are passing your multimap by value, which makes a copy. Pass it by reference instead and all will be well.
damn the fuck...you are right!!! my goodness... just an ampersand and all goes gaga...shitting myself all night...fuck it again and thank you very much :)
Topic archived. No new replies allowed.