async: client: add preserve function and fix proxy

Add a method to "preserve" a client so that the string's captured can
live beyond a scope.  Fix the proxy preserve function.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I28f32513f482b6d8752766af0368f837e365607a
diff --git a/include/sdbusplus/async/client.hpp b/include/sdbusplus/async/client.hpp
index 44f4565..bf0da03 100644
--- a/include/sdbusplus/async/client.hpp
+++ b/include/sdbusplus/async/client.hpp
@@ -67,6 +67,13 @@
     {
         return client<S, true, Preserved, Types...>(ctx, proxy.path(p));
     }
+
+    /* Convert client into a Preserved Proxy. */
+    auto preserve() const noexcept
+        requires(!Preserved)
+    {
+        return client<S, P, true, Types...>(ctx, proxy.preserve());
+    }
 };
 
 } // namespace client
diff --git a/include/sdbusplus/async/proxy.hpp b/include/sdbusplus/async/proxy.hpp
index 3bcb55c..2117921 100644
--- a/include/sdbusplus/async/proxy.hpp
+++ b/include/sdbusplus/async/proxy.hpp
@@ -104,8 +104,10 @@
     auto preserve() const noexcept
         requires(!Preserved)
     {
-        return proxy<S, P, I, true>{std::string{this->s}, std::string{this->p},
-                                    std::string{this->i}};
+        using result_t = proxy<S, P, I, true>;
+        return result_t(typename result_t::value_t<S>(this->s),
+                        typename result_t::value_t<P>(this->p),
+                        typename result_t::value_t<I>(this->i));
     }
 
     /** Perform a method call.