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 ...

Get API Design for C++, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.