boost::algorithm::trim_right_if — Right trim - parametric.
template<typename SequenceT, typename PredicateT> void trim_right_if(SequenceT & Input, PredicateT IsSpace);
Remove all trailing spaces from the input. The supplied predicate is used to determine which characters are considered spaces. The input sequence is modified in-place.
Parameters
An input sequence
An unary predicate identifying spaces