Click here to Skip to main content
15,910,886 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how to get Accurat floating point value from one control to another Pin
Nelek27-Nov-07 3:11
protectorNelek27-Nov-07 3:11 
QuestionHow to change default language of WinXP/Win2K Pin
galroy27-Nov-07 1:39
professionalgalroy27-Nov-07 1:39 
QuestionRe: How to change default language of WinXP/Win2K Pin
Rajesh R Subramanian4-Jan-08 6:49
professionalRajesh R Subramanian4-Jan-08 6:49 
GeneralRe: How to change default language of WinXP/Win2K Pin
galroy5-Jan-08 21:15
professionalgalroy5-Jan-08 21:15 
QuestionBest solution for checking for duplicate values when adding to array or std::vector Pin
NJed27-Nov-07 1:28
NJed27-Nov-07 1:28 
AnswerRe: Best solution for checking for duplicate values when adding to array or std::vector Pin
Nemanja Trifunovic27-Nov-07 1:34
Nemanja Trifunovic27-Nov-07 1:34 
GeneralRe: Best solution for checking for duplicate values when adding to array or std::vector Pin
NJed27-Nov-07 1:39
NJed27-Nov-07 1:39 
AnswerRe: Best solution for checking for duplicate values when adding to array or std::vector Pin
Nelek27-Nov-07 3:04
protectorNelek27-Nov-07 3:04 
Or just make your own validation methode before saving.

BOOL CYourClass::ValidateVertex (vertex vData, int ArrayLimit)
{
   int nError = 0;
   for (int = 0; i < ArrayLimit; i++)
   {
      if ((m_YourVector[i].x == vData.x) && (m_YourVector[i].y == vData.y) && (m_YourVector[i].z == vData.z))
      {  
         nError++;
         break;    //A match is found, dont need to continue
      }
   }
;
   if (nError)
      return FALSE;
;
   return TRUE;
}
;
;
//that in your code to read from file and save it to the vector
   
   do
   {  //read the next struct and place it in "vertex vNowReading"
      if (ValidateVertex (vNowReading, nAlreadySavedVertex))   //If its true there was no match
      {   SaveTheDataAtTheEndOfYourVector (vNowReading);
          nAlreadySavedVertex++;
      }
      //other possible things
   } while (FileNotEnded);



Or something like this.

BTW if you dont know a priori how large the vector is going to be, because of repetitions... would not be better to use a list instead a vector ??

The only and biggest problem... if there are a LOT of data... the validation will take longer as the saved data amount increases. But this should be always the same, no matter which methode you use.

Hope it helps



Greetings.

--------
M.D.V. Wink | ;)

If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson

QuestionRich edit control Pin
Maynka27-Nov-07 1:19
Maynka27-Nov-07 1:19 
QuestionRe: Rich edit control Pin
David Crow27-Nov-07 3:27
David Crow27-Nov-07 3:27 
AnswerRe: Rich edit control Pin
Hamid_RT29-Nov-07 4:08
Hamid_RT29-Nov-07 4:08 
Questionconvert 'char *' to 'LPCTSTR' Pin
neha.agarwal2727-Nov-07 1:08
neha.agarwal2727-Nov-07 1:08 
AnswerRe: convert 'char *' to 'LPCTSTR' Pin
Cedric Moonen27-Nov-07 1:14
Cedric Moonen27-Nov-07 1:14 
AnswerRe: convert 'char *' to 'LPCTSTR' Pin
Kenan Aksoy27-Nov-07 1:59
Kenan Aksoy27-Nov-07 1:59 
GeneralRe: convert 'char *' to 'LPCTSTR' Pin
Cedric Moonen27-Nov-07 2:14
Cedric Moonen27-Nov-07 2:14 
GeneralRe: convert 'char *' to 'LPCTSTR' Pin
krmed27-Nov-07 2:10
krmed27-Nov-07 2:10 
GeneralRe: convert 'char *' to 'LPCTSTR' Pin
Cedric Moonen27-Nov-07 2:17
Cedric Moonen27-Nov-07 2:17 
GeneralRe: convert 'char *' to 'LPCTSTR' Pin
krmed27-Nov-07 6:58
krmed27-Nov-07 6:58 
GeneralI understand the point, but Pin
CPallini27-Nov-07 3:02
mveCPallini27-Nov-07 3:02 
GeneralRe: I understand the point, but Pin
krmed27-Nov-07 5:47
krmed27-Nov-07 5:47 
GeneralRe: I understand the point, but Pin
CPallini27-Nov-07 6:04
mveCPallini27-Nov-07 6:04 
GeneralRe: I understand the point, but Pin
krmed27-Nov-07 6:56
krmed27-Nov-07 6:56 
AnswerRe: convert 'char *' to 'LPCTSTR' Pin
David Crow27-Nov-07 3:28
David Crow27-Nov-07 3:28 
AnswerRe: convert 'char *' to 'LPCTSTR' Pin
Mark Salsbery27-Nov-07 7:01
Mark Salsbery27-Nov-07 7:01 
AnswerRe: convert 'char *' to 'LPCTSTR' Pin
Hamid_RT29-Nov-07 4:07
Hamid_RT29-Nov-07 4:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.