0

I am trying to pass 6 values instead of a value.

//function that contains the value
siteNEVObjectdic::siteNEVObjectdic(double iLat1, double iLong1, double iLat2, double iLong2, double iLat3, double iLong3)
{
     Lat1=iLat1;
     Long1=iLong1;
     Lat2=iLat2;
     Long2=iLong2;
     Lat3=iLat3;
     Long3=iLong3;

}

multimap<double,double> dic;//initialization
dic.insert(pair<double,double>(2,gcnew siteNEVObjectdic(Lat1,Long1,Lat2,Long2,Lat3,Long3));

for some reason it is,

error C2665: 'std::pair<_Ty1,_Ty2>::pair' : none of the 3 overloads could convert all the argument types

giving me this error. any help will be appreciated.

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621

1 Answers1

0

You're creating a pair but trying to push a siteNEVObjectdic object in as the second entry. Try,

multimap<double,siteNEVObjectdic> dic;//initialization
dic.insert(pair<double,siteNEVObjectdic>(2,siteNEVObjectdic(Lat1,Long1,Lat2,Long2,Lat3,Long3));
PherricOxide
  • 15,493
  • 3
  • 28
  • 41
  • dic.insert(pair(2,gcnew siteNEVObjectdic(Lat1,Long1,Lat2,Long2,Lat3,Long3)); multimap dic; when i changed this i get an error as it pair does not support second argument as unmanaged – sudhir mohanraj Oct 17 '12 at 00:44
  • If i have to push more than one value for each key in multimap than how do i achieve that. – sudhir mohanraj Oct 17 '12 at 00:47
  • You combine them into an object and push the object into the multimap like you're trying. You just need to get the template types correct. You have , it needs to be or a pointer to a siteNEVObjectdic (but apparently you're using managed code). – PherricOxide Oct 17 '12 at 03:51
  • thanks for your help. I tried to do what you suggested, multimap dic;//initialization dic.insert(pair(2,siteNEVObjectdic(Lat1,Long1,Lat2,Long2,Lat3,Long3)); and this is the error i am getting error C3699: '&' : cannot use this indirection on type 'const testdll::siteNEVObjectdic' Error 2 cannot declare a managed 'second' in an unmanaged 'std::pair<_Ty1,_Ty2>' Error 3 'std::pair<_Ty1,_Ty2>::second' : you cannot embed an instance of a reference type, 'testdll::siteNEVObjectdic', in a native type – sudhir mohanraj Oct 18 '12 at 15:00
  • http://stackoverflow.com/questions/3373012/hashmap-dealing-with-managed-objects-c/12963554#12963554 – sudhir mohanraj Oct 18 '12 at 20:52
  • above site helped me out thanks a lot you guys :) really helpful – sudhir mohanraj Oct 18 '12 at 20:52