mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 01:20:42 +00:00
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.
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
// 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<A &, B &>() { return std::tie(first, second); }
|
||||
};
|
||||
|
||||
template <typename A, typename B>
|
||||
pair<A, B> make_pair(const A &a, const B &b)
|
||||
{
|
||||
pair<A, B> ret;
|
||||
ret.first = a;
|
||||
ret.second = b;
|
||||
return ret;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct array
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user