Added template for initialize a vector of objects with different values.