c++ - Trouble with user defined data type in map -


goal : make map of student registrations via key, student number.

issue : seems reason when go add object map os crashes program.

structure of registration object:

private: std::string fname;          std::string lname;           long studentid;             unsigned semester;           vector<result> results;  //user defined data structure, tested , works 

map declaration:

std::map<long, registration> studentregistrations; 

i use studentid in object key. test created registration object, set it's studentid , passed following method in class encapsulates map, called registrar.

 void registrar::setregistration(registration& regist) {     studentregistrations[regist.getstudentid()] = regist; //crashes here } 

my main:

int main() {     registration regist;     registrar r;      regist.setstudentid(200);     r.setregistration(regist); } 

program returns -1073741819 <0xc00000005> on windows. if in anyway helps.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -