Generally speaking - unless you are using templates or specialisations of templates - code that needs to deduce the type of a variable is normally badly broken. There are usually design alternatives.
Why don't you describe what you are trying to achieve, rather than how you have decided to achieve it? Odds are, someone will be able to offer a better approach (or point out why you're trying to achieve something silly, which is still a possibility).