Commit 766fd20f authored by Alexey Smirnov's avatar Alexey Smirnov Committed by Alexander Alekhin

Merge pull request #13745 from smirnov-alexey:gapi_add_gout_overloading

* Add GOut overloading for tuple of parameter pack

* Move getGOut_impl into namespace and add const to input references
parent 315e7fbb
......@@ -76,6 +76,30 @@ template<typename... Ts> inline GProtoOutputArgs GOut(Ts&&... ts)
return GProtoOutputArgs(detail::packArgs(std::forward<Ts>(ts)...));
}
namespace detail
{
// Extract elements form tuple
// FIXME: Someday utilize a generic tuple_to_vec<> routine
template<typename... Ts, int... Indexes>
static GProtoOutputArgs getGOut_impl(const std::tuple<Ts...>& ts, detail::Seq<Indexes...>)
{
return GProtoOutputArgs{ detail::packArgs(std::get<Indexes>(ts)...)};
}
}
template<typename... Ts> inline GProtoOutputArgs GOut(const std::tuple<Ts...>& ts)
{
// TODO: think of std::forward(ts)
return detail::getGOut_impl(ts, typename detail::MkSeq<sizeof...(Ts)>::type());
}
// Takes rvalue as input arg
template<typename... Ts> inline GProtoOutputArgs GOut(std::tuple<Ts...>&& ts)
{
// TODO: think of std::forward(ts)
return detail::getGOut_impl(ts, typename detail::MkSeq<sizeof...(Ts)>::type());
}
// Extract run-time arguments from node origin
// Can be used to extract constant values associated with G-objects
// (like GScalar) at graph construction time
......
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