Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use default in C++ to clarify the default semantics

Shulou Source: shulou.com Published: 2022-06-01 19:12:09 10月03日 Update

This article mainly introduces "how to use default in C++ to clarify the default semantics". In daily operation, I believe many people have doubts about how to use default in C++ to make clear the default semantics. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "how to use default in C++ to clarify the default semantics". Next, please follow the editor to study!

C.80: if you explicitly want to use the default semantics, use = default

Reason (reason)

The compiler is more likely to handle the semantics of the default function correctly, and you can't do better than the compiler.

Example (sample) class Tracer {

String message

Public:

Tracer (const string& m): message {m} {cerr ~ Tracer () {cerr

Tags: Semantics Clearing Compiler Learning compiling function same copy more example work help Mobile verbose practical Special tedious next cause reverse Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft vpn Xiaomi MariaDB Redmi