The following codes can run very well in WINDOWS and LINUX but fail in MAC:
template <typename T>
inline bool similar_fun(const std::vector<T> &a, const std::vector<T> &B, T threshold)
{
using namespace std::placeholders;
std::vector<T> differ;
std::transform(a.begin(), a.end(), b.begin(),
std::back_inserter(differ), std::bind(sub_fun<T>, _1, _2));
return (std::accumulate(differ.begin(), differ.end(), static_cast<T>(0), Norm2<T>()) <= threshold);
}
The development platform is Xcode 4, and the compiler is Clang LLVM 1.0. I also make sure that the compiler is using the new C++ standard c++0x. The error messages are as follows:
using namespace std::placeholders; *Expect namespace name
std::bind(sub_fun) *No member named "bind" in namespace std