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
pull/13784/head
Alexey Smirnov 6 years ago committed by Alexander Alekhin
parent 315e7fbbee
commit 766fd20faa
  1. 24
      modules/gapi/include/opencv2/gapi/gproto.hpp

@ -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

Loading…
Cancel
Save