title: How to return from a non-void function?
body: <p>I have a function below that searches through a vector of <code>my_type</code>. Currently, it has a compilation warning: <code>control reaches end of non-void function [-Wreturn-type]</code>. It appears that as long as I am using a reference as my return type rather than a pointer, it is not possible to return a null-like value? </p>
  
  <pre><code>struct my_type{
      type_a a;
      type_b b;
  }
  
      type_b&amp; value(type_a&amp; t){
          typename std::vector&lt;my_type&gt;::iterator it;  
          for(it = v.begin(); it != v.end(); ++it){
              if ((*it).a == t) return (*it).b;
              }
      }
  </code></pre>