From 05d0e2eb77653518cf94037e66ae65ab61df6733 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 7 Apr 2017 10:54:21 +0100 Subject: [PATCH] Add utility functions for rdctype::pair, make_pair and cast to tuple * make_pair is obvious, the cast to tuple allows using std::tie to split a returned pair into two local variables. --- renderdoc/api/replay/basic_types.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/renderdoc/api/replay/basic_types.h b/renderdoc/api/replay/basic_types.h index c03d19a01..37159fb79 100644 --- a/renderdoc/api/replay/basic_types.h +++ b/renderdoc/api/replay/basic_types.h @@ -29,6 +29,7 @@ #include #include #include +#include #include // we provide a basic templated type that is a fixed array that just contains a pointer to the @@ -46,8 +47,19 @@ struct pair { A first; B second; + + operator std::tuple() { return std::tie(first, second); } }; +template +pair make_pair(const A &a, const B &b) +{ + pair ret; + ret.first = a; + ret.second = b; + return ret; +} + template struct array {