答案是: POD (plain old data) type 可以。POD type 可和 C 互通, CPP Reference POD Type 的介紹:
Specifies that the type is POD (Plain Old Data) type. This means the type is compatible with the types used in the C programming language, can be manipulated using C library functions: it can be created with std::malloc, it can be copied with std::memmove, etc, and can be exchanged with C libraries directly, in its binary form.
C++11 開始可用 std::is_pod 判斷
在看 POD 定義的過程發現 Standard layout type 的定義也重要的:
Specifies that a type is standard layout type. Standard layout types are useful for communicating with code written in other programming languages.
符合 standard layout type 才能用 reinterpret_cast 轉型成第一個 member 的 type
不過最穩的最法是直接用 C++11 提供的 std::is_trivially_copyable 判斷, 成立的話就可以安心地用 memcpy。