That's way too fancy for such a simple assert:
Code:#include <type_traits> #include <vector> #include <string> using namespace std; template <typename T> void foo(T& cont) { static_assert(is_same<typename T::value_type, string>::value, "Contained element must be string"); } int main() { vector<int> vi; foo(vi); return 0; }