Data objects refer to C++ objects that do not allocate any resources, particularly that do not allocate any memory. This makes them behave just like ordinary C structures, in that both, the copy constructor and assignment operator are equivalent to a memcopy of the memory taken by the object. Examples for data objects are all builtin types such as int
or double
or simple classes such as complex
.
We distinguish data objects from general C++ objects that may include some allocation of resources. (Note that for general C++ objects that do allocate resources, this must be respected by providing appropriate copy constructor and assignment operators.) An example for a general C++ class is class DataArray.
The distinction between data and general C++ objects becomes relevant when using such objects in container classes such as DataArray or Array.