title: function which is able to return different types?
body: <p>I am trying to create a function in c++, I am wondering if I can create it such that it is able to return different types of vectors. e.g based on different case it returns vector string, int, double or ...anything.
  Is it possible in c++? (I do not want to use overload function with different arg(S) and different returns)
  I am very new to C++ and my question may seem to be stupid. </p>
  
  <p>here is a piece of my code:</p>
  
  <p>//zero here means intersection</p>
  
  <pre><code>std::vector&lt;??????&gt; findZeros(const mesh::Region&amp; s, char *model) const
  {
  //Point  
    if( model == "point" )
    {
      std::vector&lt;Vertex&gt; zeros;
      for(Region::pointIterator it = s.beginPoint(); itv != s.endPoint(); ++itv )
      {
        if( abs(Val(*it)) &lt; 1.e-12 )      
        zeros.push_back(*it);
      }
      std::vector&lt;point&gt; zerosP(zeros.begin(), zeros.end());
      return zerosP;
    }
   //line
    else if (EntityS == "line")
    {
      std::vector&lt;line&gt; zerosE;
      std::vector&lt;Point&amp;&gt; PointE;
      for(Region::lineIterator ite = s.beginLine(); ite != s.endLine(); ++ite )
      {
        Line ed = *ite;
          Point P0 = ed.point(0);
          Point P1 = e.point(1);
          if( ......... ) zerosE.push_back(ed);
          else if ( ....... )
          {
           PontE.push_back( P0, P1);
           zerosE.push_back(ed);
          }
        }
  </code></pre>
  
  <p>//here I want to return  "point" or "line with its points" or in upper level our surface.
  //I want to do all in one function!
        }</p>