It is OK to just copy the memory when your class or struct contains only fundamental members (
is_fundamental - C++ Reference[
^]) as in your example.
Note that there is usually an implicitly-declared copy assignment operator which handles also class members (calls their copy operator). See
Copy assignment operator - cppreference.com[
^].
If your class allocates memory storing the pointer in a member variable, you should always provide a copy operator (as in the mentioned SO link where
strdup
is used to copy the content of an allocated string).
There is no difference for Windows and Linux. It's just C++.