From 766fd20faa101f60ce4a9ca5aefab18bb8822519 Mon Sep 17 00:00:00 2001 From: Alexey Smirnov Date: Fri, 8 Feb 2019 13:16:50 +0300 Subject: [PATCH] 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 --- modules/gapi/include/opencv2/gapi/gproto.hpp | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/modules/gapi/include/opencv2/gapi/gproto.hpp b/modules/gapi/include/opencv2/gapi/gproto.hpp index 8b53d9b642..7f50623bee 100644 --- a/modules/gapi/include/opencv2/gapi/gproto.hpp +++ b/modules/gapi/include/opencv2/gapi/gproto.hpp @@ -76,6 +76,30 @@ template inline GProtoOutputArgs GOut(Ts&&... ts) return GProtoOutputArgs(detail::packArgs(std::forward(ts)...)); } +namespace detail +{ + // Extract elements form tuple + // FIXME: Someday utilize a generic tuple_to_vec<> routine + template + static GProtoOutputArgs getGOut_impl(const std::tuple& ts, detail::Seq) + { + return GProtoOutputArgs{ detail::packArgs(std::get(ts)...)}; + } +} + +template inline GProtoOutputArgs GOut(const std::tuple& ts) +{ + // TODO: think of std::forward(ts) + return detail::getGOut_impl(ts, typename detail::MkSeq::type()); +} + +// Takes rvalue as input arg +template inline GProtoOutputArgs GOut(std::tuple&& ts) +{ + // TODO: think of std::forward(ts) + return detail::getGOut_impl(ts, typename detail::MkSeq::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