On Wed, Nov 28, 2012 at 7:35 PM, Nathan Crookston <nathan.crookston@gmail.com> wrote:
[...]
With or without a change to result_of, I believe there's value in allowing the user to explicitly specify the result_type of a callable object passed to transformed. Ticket #7748[1] contains a patch which permits that.
I would think a preferable (in the sense of separation of concerns, modularity, what-have-you) solution would be an addition to Boost.Functional (or whatever) that basically wraps a callable object and forces its result_type to be some specified template parameter. E.g.,
template< class F, class R >
struct result_binder
{
F f;
typedef R result_type;
template< class... T >
result_type operator()(T&&... x) const
{ return f(std::forward<T>(x)...); }
};
template< class R, class F >
result_binder<F,R>
bind_result(F&& f)
{ return result_binder<F,R>{std::forward<F>(f)}; }
[or something like that]
- Jeff