| 124 | } |
| 125 | |
| 126 | void CopyFromSpanImpl(flatbuffers::true_type, |
| 127 | flatbuffers::span<const T, length> src) { |
| 128 | // Use std::memcpy() instead of std::copy() to avoid performance degradation |
| 129 | // due to aliasing if T is char or unsigned char. |
| 130 | // The size is known at compile time, so memcpy would be inlined. |
| 131 | std::memcpy(data(), src.data(), length * sizeof(T)); |
| 132 | } |
| 133 | |
| 134 | // Copy data from flatbuffers::span with endian conversion. |
| 135 | void CopyFromSpanImpl(flatbuffers::false_type, |