最近在使用封装一个Socket类时遇到函数冲突的问题,情况是这样的,Socket中有一个bind函数, 原型如下 :
// socket.h
int bind(int, const struct sockaddr *, socklen_t)
该函数是绑定Socket, 而在C++11中增加了std::bind(_Fp &&__f, _BoundArgs &&__bound_args...) 函数, 可以用该函数绑定函数指针, 当在C++类中添加了using namespace std;之后,如果你想调用socket.h中的bind方法则会出现问题, 使得bind函数调用不是你想要的行为。
解决方案是在使用socket.h的bind函数的类中不要使用using namespace std。
C++11新特性:Lambda函数(匿名函数) http://www.linuxidc.com/Linux/2013-12/93367p2.htm
C++ Primer Plus 第6版 中文版 清晰有书签PDF+源代码 http://www.linuxidc.com/Linux/2014-05/101227.htm
读C++ Primer 之构造函数陷阱 http://www.linuxidc.com/Linux/2011-08/40176.htm
读C++ Primer 之智能指针 http://www.linuxidc.com/Linux/2011-08/40177.htm
读C++ Primer 之句柄类 http://www.linuxidc.com/Linux/2011-08/40175.htm
C++11 获取系统时间库函数 time since epoch http://www.linuxidc.com/Linux/2014-03/97446.htm
C++11中正则表达式测试 http://www.linuxidc.com/Linux/2012-08/69086.htm
本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-09/106152.htm
