title: switch depending on object type
body: <p>I was wondering if there is a way of doing the following in the better way (easier to read, less verbose).</p>
  
  <p>I have the object Foo which has it concrete Foo implementation types lets call them Foo1 .. FooN. </p>
  
  <p>I also have the string table of descriptions of the foo for instance Foo1 "bars the Foo1". What I want to do is some kind of the type check depending on the actual type of Foo coming to function. Currently I do:</p>
  
  <pre><code>std::string fooUtils::translate(Foo * foo){
     if(typeid(foo) == typeid(Foo1){
        return "bars the Foo1";
     }
     else if
       ...
  }
  </code></pre>
  
  <p>I was wondering whether there is any better way of doing so. </p>
  
  <p>The first one I think of is storing the std::map &lt; std::typeinfo, std::string > - this is the solution I am keen on going for but I am unaware of any side effects of having the type info as a key to the map (are there any?). I was also wondering if there is anything to  compare types in less verbose way for instance boost::is_type&lt; Foo1 , foo > or something like this.</p>