How can C++ avoid inadvertently writing non-generic code
This article introduces the knowledge of "how to avoid inadvertently writing non-general code in C++". Many people will encounter this dilemma in the operation of actual cases. next, let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!
Reason (reason)
Generality. Reusability. Don't gratuitously commit to details; use the most general facilities available.
Versatility. Reusability. Don't get caught up in details for no reason. Use available, more generic features.
Example (sample)
Use! = instead of < to compare iterators;! = works for more objects because it doesn't rely on ordering.
Use! = instead of