Add debug helper for std::variant

Change-Id: Ifb2f47203fb5c101be5b2180693e39ba07b90c2e
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Anton Alimoff
2021-11-16 17:48:30 +03:00
committed by tomasiche
parent 93d67dd6ac
commit d06183d9cc

View File

@@ -1068,6 +1068,16 @@ def qdump__std____1__valarray(d, value):
d.putItemCount(size)
d.putPlotData(begin, size, innerType)
def qdump__std__variant(d, value):
which = int(value["_M_index"])
type = d.templateArgument(value.type, which)
d.putValue("<%s:%s>" % (which, type.name))
d.putNumChild(1)
if d.isExpanded():
storage = value["_M_u"]["_M_first"]["_M_storage"]
with Children(d, 1):
d.putSubItem("value", storage.cast(type))
def qform__std__vector():
return [DisplayFormat.ArrayPlot]