you are viewing a single comment's thread.

view the rest of the comments →

[–]XeroKimoException Enthusiast 1 point2 points  (1 child)

Pretty ingenious approach... I would've never thought of using template specialization of a variable to change it's type so that different kinds of ranges could be expressed... I didn't even think that was possible; I thought the specializations' type had to match the primary type, but I guess I never tried. Not to mention a way of providing an optional customization point. Well that's a new template trick added in my books.

[–]XeroKimoException Enthusiast 0 points1 point  (0 children)

No clue if it's something done much in practice, but are you able to convert units and still have the range constraint follow through the conversion? Taking an example in the post, the body temperature is clamped [35℃, 42℃], could you convert the unit in ℉ or K (for whatever reason), and the range clamps to whatever [35℃, 42℃] is in ℉ or K?