make pack_raw, pack_raw_length, pack_array_length, and pack_map_length non-member template functions to make it possible to specialise them