title: Return a "NULL" object if search result not found
body: <p>I'm pretty new to C++ so I tend to design with a lot of Java-isms while I'm learning. Anyway, in Java, if I had class with a 'search' method that would return an object <code>T</code> from a <code>Collection&lt; T ></code> that matched a specific parameter, I would return that object and if the object was not found in the collection, I would return <code>null</code>. Then in my calling function I would just check <code>if(tResult != null) { ... }</code></p>
  
  <p>In C++, I'm finding out that I can't return a <code>null</code> value if the object doesn't exist. I just want to return an 'indicator' of type T that notifies the calling function that no object has been found. I don't want to throw an exception because it's not really an exceptional circumstance.</p>
  
  <p>This is what my code looks like right now:</p>
  
  <pre><code>class Node {
      Attr&amp; getAttribute(const string&amp; attribute_name) const {
         //search collection
         //if found at i
              return attributes[i];
         //if not found
              return NULL; // what should this be?
      }
  
  private:
      vector&lt;Attr&gt; attributes;
  }
  </code></pre>
  
  <p>How can I change it so I can give that kind of marker?</p>