check that type is a templated type before trying to create it in TreeBuffer and add new example demonstrating how to create trees containing user-defined types