"contains" function for STL containers
If you like new features, and even experimental features, you can make your code a lot cleaner. 

Concepts

A lot of those arcane SFINAE techniques will be obsolete once concepts are out, and concepts are already available in an experimental state with the last versions of gcc (enable them with the -fconcepts option):

template &lt;typename Container, typename Value&gt;
concept bool HasFindFunction = requires(Container c, Value v) {
    c.find(v);
};


... and that's it for your trait. 

if constexpr

To specialize the contains function, you can rely on C++17 if constexpr. It's a compile-time if, in which only the chosen branch has to be well-formed. So, here's what you could write:

template &lt;typename Container, typename Value&gt;
auto find(Container&amp;&amp; cont, Value&amp;&amp; val) {
    if constexpr (HasFindFunction&lt;Container, Value&gt;) {
        std::cout &lt;&lt; "member find\n";
        return cont.find(val);
        }
    else { 
        std::cout &lt;&lt; "algorithm find\n";
        return std::find(std::begin(cont), std::end(cont), val);
    }
}


I replace contains by find, because I find it a pity to make a hard won information (the item position) go to waste. You can then write contains on top of it.

Complete working example (g++ prog.cc -Wall -Wextra -std=gnu++2a -fconcepts)

#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;map&gt;
#include &lt;algorithm&gt;

template &lt;typename Container, typename Value&gt;
concept bool HasFindFunction = requires(Container c, Value v) {
    c.find(v);
};

template &lt;typename Container, typename Value&gt;
auto find(Container&amp;&amp; cont, Value&amp;&amp; val) {
    if constexpr (HasFindFunction&lt;Container, Value&gt;) {
        std::cout &lt;&lt; "member find\n";
        return cont.find(val);
        }
    else {
        std::cout &lt;&lt; "algorithm find\n";
        return std::find(std::begin(cont), std::end(cont), val);
    }
}

template &lt;typename Container, typename Value&gt;
auto contains(Container&amp;&amp; c, Value&amp;&amp; v) {
    return std::end(c) != find(c, std::forward&lt;Value&gt;(v));
}

int main() {
    std::map&lt;int, int&gt; map;
    std::vector&lt;int&gt; vector;

    find(map, 5);
    contains(vector, 5);
}