Showing posts with label sort. Show all posts
Showing posts with label sort. Show all posts

Saturday, November 2, 2013

Generic C-Trees and C++ std::maps

How many lines of code do I need, to set up a typical tree structure? What are the pros and cons between a C-style generic tree and an std::map or an std::set ?

Wednesday, October 30, 2013

How to write a compare function


std::map , std::set and std::sort may require that you write a custom compare function, so the elements can be sorted.
Writing the compare function correctly is critical, as a mistake can make your program crash.
There is a typical pattern you can follow, to write a compare function.