Kevin Vance - Lessons learned today: Just saying hash_map<char…

Entries | Archive | Friends | Friends' Friends | User Info

05:28 pm

Wednesday, October 20th, 2004
Previous Entry Share Next Entry
Lessons learned today:
  1. Just saying hash_map<char *,something> will not do the right thing, even though it kinda looks like it might. You have to define eqstr (from the STL docs) and say hash_map<char *,something,hash<char *>,eqstr>

    I now hate C++ for a completely different set of reasons than I did before I decided to go to college.

  2. glutMainLoop never ends, but you can get out of it if you don't mind a few dark side points:
    result = setjmp(env);
    if(run_glut)
        glutMainLoop();
    Then, when you want to get out of the main loop in one of your callbacks, you just say:
    run_glut = false;
    longjmp(env, retval);
Now that I've finished hacking to death these unrelated issues, perhaps I can get back to working on code for my actual PROJECT!@$*&@!

Current Music Purple Motion - Excerpts from the Oceanic Suite
Link )Reply )

Comments
[User Picture]From: teferi
2004-10-20 10:45 pm (UTC)

re: 1

alternatively, you could just use a std::string, which gives you the additional advantages of avoiding buffer overruns and such
(Reply) (Thread)
[User Picture]From: kvance
2004-10-20 11:39 pm (UTC)

Re: 1

I tried using std::string first, since I was still under the impression that STL was useful when I started doing this. It failed pretty spectacularly; I think it wanted me to write my own hash function for std::string.
(Reply) (Parent) (Thread)