// fastest way to copy any data of compile-time-known size : //======================================================================================== template void static_copy_bytes(T1 *to,const T2 *fm) { struct char_array { char data[size]; }; *(reinterpret_cast< char_array *>(to)) = *(reinterpret_cast(fm)); } template void static_copy_entries(T *to,const T *fm) { struct entry_array { T data[count]; }; *(reinterpret_cast< entry_array *>(to)) = *(reinterpret_cast(fm)); } void static_memcpy_test() { int fm[32] = { 4, 7 , 0 }; int to[32]; int to2[32]; static_copy_bytes<32*4>(to,fm); static_copy_entries<32>(to2,fm); printf("%d %d\n",to[0],to[1]); } //========================================================================================