I once told someone that not every container supports rbegin(). Now I know all standard STL container class templates define rbegin(). STL string class also supports rbegin(). By the way, If you specialize vector (or any container) class-template with your own Account class, you end up with a specialized class-template. You must re-implement rbegin() and all public methods. That’s part of the “contract”.
Now, WHO don’t support rbegin()?
– The simple array doesn’t support rbegin() or any method for that matter.
– I think ostream and istream don’t provide rbegin().
– How about hashed containers? They don’t have a rbegin()
What if someday someone creates a useful container that doesn’t support rbegin()? If your algorithm insists on a container defining rbegin(), then this algo can’t be used for that new container.
In conclusion, it’s probably more useful in practice to write utility functions accepting iterator arguments, not container arguments. Follow STL algorithm conventions.