Commit 169872e5 by Ben Clayton Committed by Ben Clayton

Reactor: Replace ArgI for std::tuple_element

C++ now provides this template magic so you don't have to. Also remove Arg(Function<Return(Arguments...)> &) function that wasn't referenced and wouldn't compile if it were. Bug: b/126126820 Bug: b/129403963 Change-Id: I939e4f7cb95c32b8e663df7da6211460c5de605f Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/25749 Presubmit-Ready: Ben Clayton <bclayton@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarBen Clayton <headlessclayton@gmail.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent ff1cedef
......@@ -23,6 +23,7 @@
#include <cstdio>
#include <string>
#include <tuple>
#undef Bool // b/127920555
......@@ -2274,21 +2275,6 @@ namespace rr
template<class T>
void Return(RValue<Pointer<T>> ret);
template<unsigned int index, typename... Arguments>
struct ArgI;
template<typename Arg0, typename... Arguments>
struct ArgI<0, Arg0, Arguments...>
{
typedef Arg0 Type;
};
template<unsigned int index, typename Arg0, typename... Arguments>
struct ArgI<index, Arg0, Arguments...>
{
typedef typename ArgI<index - 1, Arguments...>::Type Type;
};
// Generic template, leave undefined!
template<typename FunctionType>
class Function;
......@@ -2303,10 +2289,10 @@ namespace rr
virtual ~Function();
template<int index>
Argument<typename ArgI<index, Arguments...>::Type> Arg() const
Argument<typename std::tuple_element<index, std::tuple<Arguments...>>::type> Arg() const
{
Value *arg = Nucleus::getArgument(index);
return Argument<typename ArgI<index, Arguments...>::Type>(arg);
return Argument<typename std::tuple_element<index, std::tuple<Arguments...>>::type>(arg);
}
Routine *operator()(const char *name, ...);
......@@ -2321,12 +2307,6 @@ namespace rr
{
};
template<int index, typename Return, typename... Arguments>
Argument<typename ArgI<index, Arguments...>::Type> Arg(Function<Return(Arguments...)> &function)
{
return Argument<typename ArgI<index, Arguments...>::Type>(function.arg(index));
}
RValue<Long> Ticks();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment