template<typename T> inline exception_ptr get_exception_ptr(shared_future<T> &f)
{
#if 1
    // Thanks to Vicente for adding this to Boost.Thread
    return f.get_exception_ptr();
#else
    // This seems excessive but I don't see any other legal way to extract the exception ...
    bool success=false;
    try
    {
        f.get();
        success=true;
    }
    catch(...)
    {
        exception_ptr e(afio::make_exception_ptr(afio::current_exception()));
        assert(e);
        return e;
    }
    return exception_ptr();
#endif
}