title: C++ "smart" predicate for stl algorithm
body: <p>I need to designe predicate for stl algorithms such as find_if, count_if.</p>
  
  <pre><code>namespace lib
  {
      struct Finder
      {
          Finder( const std::string&amp; name ):
              name_( name )
          {
          }
  
          template&lt; typename TElement &gt;
          bool operator( const TElement&amp; element )
          {
              return element.isPresent( name_ );
          }
  
          /* template&lt; typename TElement &gt;
          bool operator( const TElement&amp; element )
          {
              const Data&amp; data = element.getData();
              return data.isPresent( name_ );
          }*/ 
      };
  }
  </code></pre>
  
  <p>But I need it to have different operators () according to presence of some certain methods in TElement. Like if it has "getData" I'd like to check that data and if it hasn't I'd do some other actions.</p>
  
  <p>I am aware of SFINAE. But I don't have boost:: on the project.
  So either there is some easy implementation of template "has_method" or you know some other design solution.</p>
  
  <p>I can't point specific types and simply overload because I'd like to put this Predicate to the one of the project library, which don't know about those specific classes with "getData" method.</p>
  
  <p>Solution with class traits are good as far as there is no namespaces. Predicate Finder in in "lib" namespace and class with "getData" is in "program" namespace. </p>
  
  <p>Thanks.</p>