umd-memsys / DRAMSim2

DRAMSim2: A cycle accurate DRAM simulator
http://www.ece.umd.edu/~blj/papers/cal10-1.pdf
255 stars 151 forks source link

Error in Inserting in 3d Transaction vector #33

Closed ahmed-shafik closed 10 years ago

ahmed-shafik commented 10 years ago

I created 3D vector in MemoryController.h as shown below

            vector<vector <vector< Transaction> > > Trans3d;

In MemoryController.cpp file I used the below code to resize the vector and reserve the required entries

     Trans3d.resize(2); 
 for(int i = 0; i < 2; i++) 
     {Trans3d[i].resize(TRANS_QUEUE_DEPTH);
     for(int j = 0; j< TRANS_QUEUE_DEPTH; j++) 
  {  Trans3d[i][j].reserve(2);}}

After that, to use the push back function as below

      Trans3d[0][0].push_back(trans);

This idea worked in Visual Studio. But after trying it in the simulator I got the below error

         MemoryController.cpp: In member function قbool DRAMSim::MemoryController::addTransaction(DRAMSim::Transaction*)ق:

MemoryController.cpp:815:39: error: no matching function for call to قstd::vectorDRAMSim::Transaction::pushback(DRAMSim::Transaction&)ق MemoryController.cpp:815:39: note: candidate is: In file included from /usr/include/c++/4.7/vector:65:0, from SystemConfiguration.h:38, from Transaction.h:38, from MemoryController.h:41, from MemoryController.cpp:38: /usr/include/c++/4.7/bits/stl_vector.h:881:7: note: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = DRAMSim::Transaction; _Alloc = std::allocatorDRAMSim::Transaction; std::vector<_Tp, _Alloc>::value_type = DRAMSim::Transaction] /usr/include/c++/4.7/bits/stl_vector.h:881:7: note: no known conversion for argument 1 from قDRAMSim::Transaction_ق to قconst value_type& {aka const DRAMSim::Transaction&}ق MemoryController.cpp:831:1: warning: control reaches end of non-void function [-Wreturn-type]

dramninjasUMD commented 10 years ago

The simple fix is to write push_back(*trans) instead of push_back(trans).