// remove *all* 3's, return new ending (remaining elements unspecified) auto arrayEnd = std::remove(std::begin(array), std::end(array), 3);