1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
#include <atomic>
template < typename T, typename U, std::size_t N >
void copy( std::atomic<T>(&srce)[N], std::atomic<U>(&dest)[N] ) {
for( std::size_t i = 0 ; i < N ; ++i ) dest[i] = T(srce[i]) ;
}
int main()
{
std::atomic<int> g_channelNumbersXML[16] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
std::atomic<int> g_channelNumbersXMLArray[8][16];
std::atomic<long> g_channelNumbersXMLArray_2[8][16];
for (int i = 0; i < 8; i++) copy( g_channelNumbersXML, g_channelNumbersXMLArray[i] ) ;
for (int i = 0; i < 8; i++) copy( g_channelNumbersXML, g_channelNumbersXMLArray_2[i] ) ;
}
| |