Why does the __STL_FUNCTION_TMPL_PARTIAL_ORDER macro include the template function in std_pair.h

Today I see the following code in stl_pair.h:

#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER

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;
}

#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */

I do not think that template functions have any connection with the partial specialization of function templates. I'm wrong?

+4
source share
1 answer

How a function call is handled by the compiler

A function template call in C ++ passes through the Holy Trinity Search by name (section 3.4 in the Standard), Highlight a template argument (section 14.8.2) and Overload Resolution (section 13.3).

++ Standard,, ++ Templates: The Complete Guide Core ++ Stephan T. Lavavej

, SGI- STL, , ++ Standard, .

//* __STL_FUNCTION_TMPL_PARTIAL_ORDER: , // . (a.k.a // .)

, , ( , ).

14.5.6.2 [temp.func.order]

1 , , (14.8.2) . , :

- (13.3.3);

- ;

- delete, , (3.7.4.2, 5.3.4);

- (14.5.4), (14.7.2) (14.7.3) .

2 , , , (. ) . , . , .

0

All Articles