6: C++ usage
Abstract
This chapter deals with core C++ language features that can affect application programming interface (API) design. This includes using namespaces via either a consistent prefix for all API symbols or the C++ namespace keyword. The topic of how to declare constructors and assignment operators correctly is then covered, including the Rule of Three. Const correctness issues are then covered, including method, parameter, and return value const correctness. Template API issues are discussed, such as implicit versus explicit instantiation and best practices for laying out template header files. The section on operator overloading describes how to define operators in the most robust fashion and how to decide whether an operator ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access