Convert 2D array to std::map?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: An array can be converted into a std::vector easily and efficiently: template < typename T , int N > vector < T > array_to_vector ( T (& a )[ N ]) { return vector < T >( a , a + sizeof ( a ) / sizeof ( T )); } Is there a similar way to convert a two dimensional array into a std::map without iterating over the members? This looks like an unusual function signature, but in my particular situation, the keys and values in these maps will be of the same type. template < typename T , int N > map < T , T > array_to_map ( T (& a )[ N ][ 2