Xcode7: unknown type name error in a basic C++ program
<p>I am working on a C++ program about STL with the latest version of Xcode, and I get the error "Unknown type name 'ubResultData'" and "Unknown type name 'ubFirstArgument'". I have tried to rewrite the program with standard unary_function and binary_function, and the errors remained the same. Then, I build the progaram with VS2010 and VS2013, and it built successfully. What's wrong with the program?</p>

<p>The errors are in the last line of class binder2ND.</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;
using namespace std;

template&lt;typename InputIterator, typename Predicator&gt;
inline int countIF(InputIterator First, InputIterator Last, Predicator Pred){
    int count = 0;
    for (; First != Last; ++First) {
        if(Pred(*First))++count;
    }

    return count;
}

template&lt;typename Arg1, typename Result&gt;
struct UnaryBase{
    typedef Arg1 ubFirstArgument;
    typedef Result ubResultData;
};

template&lt;typename Arg1, typename Arg2, typename Result&gt;
struct BinaryBase{
    typedef Arg1 bbFirstArgument;
    typedef Arg2 bbSecondArgument;
    typedef Result bbResultData;
};

template&lt;typename T&gt;
struct LESS:public BinaryBase&lt;T, T, bool&gt;{
    bool operator()(const T&amp; Left, const T&amp; Right)const{
        return (Left &lt; Right);
    }
};

template&lt;typename BinOP&gt;
class binder2ND:public UnaryBase&lt;typename BinOP::bbFirstArgument, typename BinOP::bbResultData&gt;{
protected:
    BinOP OP;
    typename BinOP::bbSecondArgument Arg2;
public:
    binder2ND(const BinOP&amp; Oper, const typename BinOP::bbSecondArgument&amp; valRight):OP(Oper),Arg2(valRight){}
    ubResultData operator()(const ubFirstArgument &amp;ubArg1)const{return OP(ubArg1,Arg2);}
};

template&lt;typename BinOP, typename rightVal&gt;
binder2ND&lt;BinOP&gt; bind2ND(const BinOP&amp; OP, const rightVal&amp; vRight){
    return binder2ND&lt;BinOP&gt;(OP, vRight);
}

int main(){
    vector&lt;int&gt; myVec;
    for (int i = 0; i &lt; 50; ++i) {
        myVec.push_back(rand()%100);
    }

    int countNUm = countIF(myVec.begin(), myVec.end(), bind2ND(LESS&lt;int&gt;(), 30));
    cout &lt;&lt; "Numbers=" &lt;&lt; countNUm &lt;&lt; endl;

    return 0;
}
</code></pre>