Frank Mori Hess wrote:
No, I meant a partial specialization for optional<T> directly, i.e. last_value<optional<T> >. That makes the return value of that function object (in our case the combiner) "optional", which reflects the intention to have it not throwing for an empty input range pretty well, I think.
The work-around for compilers lacking partial specialization is to give the specialization a different class name, right (e.g. last_optional<T>)? So providing a partial specialization would result in last_value<optional<T>
throwing when compiled on some compilers and not on others. It seems less confusing to provide last_optional<T> only.
You can use last_value<optional<T> > on compilers that don't have partial template specialization as well, the implementation is just not as straightforward, but that won't be visible to the user. Regards Timmo Stange