...one of the most highly
regarded and expertly designed C++ library projects in the
world. — Herb Sutter and Andrei
boost::algorithm::erase_tail — Erase tail algorithm.
// In header: <boost/algorithm/string/erase.hpp> template<typename SequenceT> void erase_tail(SequenceT & Input, int N);
Remove the tail from the input. The tail is a suffix of a sequence of given size. If the sequence is shorter then required, the whole string is considered to be the tail. The input sequence is modified in-place.