Skip to content

Instantly share code, notes, and snippets.

@mashiro
Created November 25, 2009 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mashiro/242974 to your computer and use it in GitHub Desktop.
Save mashiro/242974 to your computer and use it in GitHub Desktop.
#include <boost/unordered_map.hpp>
#include <map>
#include <list>
#include <typeinfo>
template <typename T>
class tree
{
public:
typedef T value_type;
typedef tree<T> tree_type;
typedef std::list<T> trunk_type;
#if 1
typedef boost::unordered_map<const std::type_info*, tree_type> branch_type;
#else
typedef std::map<const std::type_info*, tree_type> branch_type;
#endif
typedef typename trunk_type::iterator iterator;
typedef typename trunk_type::const_iterator const_iterator;
typedef typename branch_type::iterator branch_iterator;
typedef typename branch_type::const_iterator const_branch_iterator;
};
int main()
{
tree<int> t;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment