C/C++操作数重载函数标准库实现

来源:互联网 发布:《物理学史》 淘宝 编辑:程序博客网 时间:2024/06/07 18:53

1.首次使用博客,记录一下首次发现的标准库重载实现

朋友可能会问,怎么查看库文件的标准实现呢?文章结尾告诉你!

  template<class _T1, class _T2>    inline bool    operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)    { return __x.first == __y.first && __x.second == __y.second; }  template<class _T1, class _T2>    inline bool    operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)    { return __x.first < __y.first      || (!(__y.first < __x.first) && __x.second < __y.second); }  template<class _T1, class _T2>    inline bool    operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)    { return !(__x == __y); }  template<class _T1, class _T2>    inline bool    operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)    { return __y < __x; }  template<class _T1, class _T2>    inline bool    operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)    { return !(__y < __x); }  template<class _T1, class _T2>    inline bool    operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)    { return !(__x < __y); }


在Linux下,你可以这么做:GCC 下可以使用 [ -E ] 选项,eg: gcc -E hello.c -o hello.i

在win下,设置VS或其他工具,设置项当前项目如下:



如此!从此查看库函数学习在无忧。。。

原创粉丝点击