trim cpp array