message: add unpack method
Add an unpack method that allows reading from the message as
r-values. This simplifies the pattern:
```
foo f{};
bar b{};
msg.read(f,b);
// Can now be written as...
auto [f, b] = msg.unpack<foo, bar>();
```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ic2ae7f2c52d41702b8c7c3af6a2efb21558a7579
diff --git a/example/list-users.cpp b/example/list-users.cpp
index 23913b0..f7ab475 100644
--- a/example/list-users.cpp
+++ b/example/list-users.cpp
@@ -18,8 +18,9 @@
"org.freedesktop.login1.Manager", "ListUsers");
auto reply = b.call(m);
- std::vector<std::tuple<uint32_t, std::string, message::object_path>> users;
- reply.read(users);
+ using return_type =
+ std::vector<std::tuple<uint32_t, std::string, message::object_path>>;
+ auto users = reply.unpack<return_type>();
for (auto& user : users)
{