-
Notifications
You must be signed in to change notification settings - Fork 2
/
result.h
29 lines (22 loc) · 889 Bytes
/
result.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once
#include "triples.h"
namespace sparqlxx
{
struct [[gnu::visibility("default")]] Solutions
{
std::vector<Var> vars;
std::vector<std::vector<Term>> rows;
Solutions() {}
Solutions(std::vector<Var> vars): vars(std::move(vars)) {}
Solutions(std::vector<Var> vars, std::vector<std::vector<Term>> rows): vars(vars), rows(rows) {}
};
struct [[gnu::visibility("default")]] None { None() {} };
using Result = xx::variant<Solutions, bool, Triples, None>;
template <typename T> struct result_of_t { using type = None; };
template <> struct result_of_t<Select> { using type = Solutions; };
template <> struct result_of_t<Ask> { using type = bool; };
template <> struct result_of_t<Construct> { using type = Triples; };
template <> struct result_of_t<Describe> { using type = Triples; };
template <typename T>
using result_of = typename result_of_t<T>::type;
}