mfawcett

Members
  • Content count

    421
  • Joined

  • Last visited

Community Reputation

373 Neutral

About mfawcett

  • Rank
    Member
  1. You should use the --stage option, which copies all the lib and dll files into a specified directory, then point visual studio lib path there.
  2. You don't have a copy c-tor defined, let alone one that outputs to cerr, did you forget to paste that?
  3. boost loop unrolling

    Boost.MPL.for_each is close, but probably not exactly what you are looking for.
  4. When A star fails

    Quote:Original post by Codeka Quote:Original post by Smjert I call the F, G and H because these are their names. If you read articles (standford, polymaniac (or something like that) wikipedia.. also university if i remember well :P). Yeah, I know, that's what I meant [smile]. It seems to be a common thing with academics to name variables with a single letter... Well, they have a perfectly good reason here... f = final g = given h = heuristic f = g + h
  5. I've used the Hoard allocator and it's quite easy to use and very fast. The Hoard Memory Allocator
  6. Quote:Original post by David Neubelt I don't know where you get that from Quote from dlmalloc.c Thread-safety: NOT thread-safe unless USE_LOCKS defined You're right, I was looking at out-dated information in older PPT presentations on the subject.
  7. Quote:Original post by David Neubelt As far as writing your own allocator I would recommend checking out Doug Lee's memory allocator (dlmalloc) http://g.oswego.edu/dl/html/malloc.html . It's the industry's verbal agreement on the best general purpose allocator out there and is used in numerous titles. I'd also recommend looking at Google's allocator. It has the added benefit of being thread-safe, unlike dlmalloc (Lea's). Google Performance Tools [Edited by - mfawcett on January 22, 2009 4:53:38 PM]
  8. C++ assignment operator

    Quote:Original post by phresnel Quote:Original post by loufoque T& T::operator=(T other) { using std::swap; ::swap(other, *this); return *this; } Why not a const reference as the parameter? Because you have to make the copy anyway if you want rollback semantics.
  9. Quote:Original post by Mantear Simply having '#include <iostream.h>' in a *.cpp source file, and nothing else, causes it to bomb out, complaining about a missing '{'. No clue if this could be the problem, but why are you including <iostream.h> in a .cpp file when you should be including <iostream> instead? Is this a legacy app?
  10. c++ making a union inside a class

    Quote:Original post by dmail No it is not it is what the OP wants! You're right that the OP wants that, but it isn't what you asked for. Quote:No this is not what I asked let me quote myself as you can not seem to read it for yourself. Quote:If you go by the assumption that there is no padding added, what is the difference between the code posted above and the following You asked for the difference between the slick trick and your code. I told you once, and I'll tell you again - the slick trick is not UB, yours is. The slick trick class uses no UB. Yours does. In *both* cases, using the address of x to get array-like access for passing to OpenGL is UB.
  11. c++ making a union inside a class

    Quote:Original post by dmail mfawcett you really do not get it do you. I see why your user rating is so low. ;) I assure you, I really *DO* get it. Quote: The OP wants to be able to pass a float pointer to OpenGL, your answer is just to return the address of x. Yet this relies on compiler specific behaviour and is not available with the "slick trick". So "If you go by the assumption that there is no padding added" why use the slick trick in the first place. Passing a float pointer to OpenGL is outside the scope of the class. Your last post asked what is different between the slick trick and the code you posted. I told you - One is defined, the second isn't. Passing a float pointer to OpenGL with either is UB.
  12. c++ making a union inside a class

    Only that you are forcing the Undefined Behavior on users of your class. The slick trick method allows you to implement your class with Standard C++. If the user decides to invoke Undefined Behavior (but almost always portable as long as the static_assert holds), that's up to him, and he can do it by taking the address of x in either case. Basically the difference is: slick trick = no UB what you just posted = UB
  13. You probably wanted: //ostream operator for testing template <typename Other> friend ostream& operator <<( ofstream &out, const CMultiset<Other> &m );
  14. c++ making a union inside a class

    Quote:Original post by dmail I had already noted that you could take the address of x, yet just to be sure align the class to avoid any potential padding. Maybe there is some way of using this trick but personally I do not see it. If somebody else asks then SiCrane may well tell. This has been gone over many times in these forums. Just use a static_assert that guarantees that sizeof(my_vec3f_t) == sizeof(float * 3). Here are some links to past discussions: a slick trick in C++ [C++, math] vector
  15. Path Planning Multiple Routes

    Yes, poor wording on my part, I apologize. by "N% different" I really meant "only 100% - N% of the optimal path can be the same as this new path". To be more precise, if you were to overlay a possible result and the optimal path, only 100% - N% of the optimal path can be co-linear for the result to be valid. In your case, 100% of the optimal path would be co-linear with the next possible solution, so it can't be considered N% different.