I'm trying to define an object named Param that has a member named value. Value can be either a variable of type T, and array of type T[], or an array of other Params. Using templates, I could implement the first two cases: class Param (T) { T value; ... } but I could not handle the recursive case.