c++ - Different overloading function resolution in VS 2008/2010 and VS 2013 -


i have function following definitions,

void classa::setlabel(int* newlabels){   try{     std::vector<int> labels(newlabels, newlabels + bonds.size());     setlabel(labels);   }   catch(const std::exception& e){     propogate_exception(e, "in function classa::setlabel(int*):");   } }  void classa::setlabel(const std::vector<int>& newlabels){   try{     std::set<int> labels(&(newlabels[0]), &(newlabels[newlabels.size()]));     if(!(bonds.size() == labels.size())){       throw std::runtime_error(exception_msg("does not match."));     }     labels = newlabels;   }   catch(const std::exception& e){     propogate_exception(e, "in function aclass::setlabel(std::vector<int>&):");   } } 

and section of code implemented

classa m; int labels[]={1,2,3,4}; m.setlabel(labels); 

in virtual c++ 2008 pro , 2010 pro, call setlabel bound second definition, resulting in vector subscript out of range error; while in vc ++ 2013 bound to first definition.

i expect consistent binding first definition. question is: (1) why such different behaviors between versions of vc++? (2) there better way design , implement interface avoid such ambiguity?

updated: removed vs installations , used vc++ 2008. resolution expected. help.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -