I have been recently experimenting with functors and tried o make my own one, inheriting from unary_operator, but I get some errors.

template <typename T, int intN = 0>
class cIsBad : public unary_function <T, bool> { 
    public:
        bool operator() (const T& tParameter) const {
            return tParameter == intN;
        }
};

I get these errors:
|2|error: expected template-name before ‘<’ token|
|2|error: expected ‘{’ before ‘<’ token|
|2|error: expected unqualified-id before ‘<’ token|
|8|warning: extra ‘;’|

P.S. I compile with gcc

class cIsBad : public [b]std::[/b]unary_function <T, bool> {

Now that was easy! ^^

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.