Improved isUnit and isQuantity with template type deduction.