it is not pattern matching , more data validation , thank you for your post , I actually did this with boost::lexical_cast , throws an exception if the required value is neither float or a string.
depends on how you set it up.