Making C++ primitive types meaningfully movable when they have sentinel values -- Raymond Chen

A little less primitive...

Making C++ primitive types meaningfully movable when they have sentinel values

by Raymond Chen

From the article:

C++ primitive types do not have special semantics for move constructor or move assignment. Their move operations are just copies. But what if you really want them to move, say, because they have a sentinel value that represents an "empty" state...?

Add a Comment

Comments are closed.

Comments (1)

0 0

Unoid said on Jan 20, 2023 07:39 AM:

Should the "default construction" and "empty" state be equivalent - like smart pointers, containers, string types...?!