   C++ Red Black Tree Template Class
  Could anyone point me in the direction of a decent C++ red black tree implementation? I've spent ages searching on google, but all the examples I've found seem to be either half finished or buggy as hell. If not I'm just gonna have to bite the bullet and write my own... I'm not lazy, I'm just sure there must be someone out there who's done it already, and better than I could :-).Thanks in advance.   
  In C++, one generally just uses std::set, which is usually implemented as a red-black tree. If you want a bare-ass red-black tree for some reason, I'd suggest finding a C implementation and going from there.   ;  Chances are you've already got one sitting on your computer; most standard library implementations of std::set and std::map use red-black trees internally.   ;  Actually, come to think of it, I do have one lying around, a quick C-to-C++ conversion of the red-black tree in kazlib. I was using it for a sweep-line algorithm, so it's a little odd: it doesn't use any sort of explicit ordering, instead requiring you to specify an insertion location. Its main operations are swap, delete, and iteration over the current ordering. Let me know if you want it.   ;Quote:I'd suggest finding a C implementation and going from thereThanks, I think I'll try that first. I have no problem implementing C++ templates, I just need something fairly easy to read and most importantly stable to get me started, so that might be a good way forward.   ;Quote:Original post by pauls_1979I've spent ages searching on google, but all the examples I've found seem to be either half finished or buggy as hell.Here is an equivalent problem:- You to hang a picture on a wall, which requires a hammer for the drive the nail in the wallThere are several ways to approach it:- mine your own ore, smelt it, fell a tree, make the handle- take a strong branch off a tree, get a length of string, tie a rock to it- go to nearest hardware store, buy a hammer for $0.99, and get a 100 piece toolset for free with itIt's same with fundamental algorithms. They come with standard library.Quote:I just need something fairly easy to read and most importantly stable to get me started, so that might be a good way forward.If this is for an assignment, then starting with some random code will not do much.Is there a reason why std:: implementations of a tree are inadequate? The whole hammer thing....   ;  Boost.Intrusive has one.Boost also has standard container implementations built on top of it.   