On 10/05/06, Joe Buck <[EMAIL PROTECTED]> wrote:
But then I just thought of another case: template <typename Container> struct foo { foo(const Container& bar) { if (bar.size() >= 0) use(bar); } }; For any STL-compliant container the test is redundant. But if we put in a rule saying to suppress the warning if the type depends on a template, we lose the warning in this case as well; after all, nothing stops someone from writing class C { public: int size() const; ... }; void use(const C&);
My STL may be a bit rusty...if you don't define size(), what is its return type?. Also, there should be no warning in this example, am I wrong?