Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How can C++ avoid inadvertently writing non-generic code

Shulou Source: shulou.com Published: 2022-06-01 20:49:43 10月02日 Update

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

Tags: More code situation tags clocking content functions functions containers knowledge examples iterations practical orderly successful learning and then reasons dilemmas size reality Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Docker vpn Shulou Tech Info macOS