I'm struggling to think up a good way to define a function in C++. Currently I'm thinking of defining a function as a set of Expressions, and a domain for each.

Ie: 3x for x > 2
-x for x < 2

Which would imply that x=2 is undefined

Are there any holes in this argument? I want my function class to be upgradable.