STL编程指南/FAQ

返回“程序设计语言”

关于SGI Standard Template Library的FAQ

  if (L.size() == 0)
    ...

Instead, you should write

  if (L.empty())
    ...
  std::stack<T> s;
  ...
  T old_value = s.top();
  s.pop();
sort(first, last, greater<T>());

(Note that it must be greater, not greater_eq. The comparison function f must be one such that f(x, x) is false for every x.)