From e1eef24321cbffdae10dad2993374b9679ff005a Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Fri, 17 Apr 2020 21:17:31 -0700 Subject: [PATCH] Fabric: Implementation of `getDebugDescription` for `std::array` Summary: Yoga uses `std::array` a lot (and `std::array` is not a `std::vector`), so it's useful for printing Yoga values. Changelog: [Internal] Fabric-specific internal change. Reviewed By: mdvacca Differential Revision: D21028570 fbshipit-source-id: c6bf114d5362f085ea201ecdc5b7d59646b33ebd --- .../fabric/debug/DebugStringConvertible.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ReactCommon/fabric/debug/DebugStringConvertible.h b/ReactCommon/fabric/debug/DebugStringConvertible.h index efab8ffaa4f..f50d9be071e 100644 --- a/ReactCommon/fabric/debug/DebugStringConvertible.h +++ b/ReactCommon/fabric/debug/DebugStringConvertible.h @@ -302,6 +302,23 @@ std::vector getDebugChildren( return vector; } +// `std::array` +template +std::string getDebugName(std::array const &array) { + return "List"; +} + +template +std::vector getDebugChildren( + std::array const &array, + DebugStringConvertibleOptions options) { + auto vector = std::vector{}; + for (auto const &value : array) { + vector.push_back(value); + } + return vector; +} + // `std::unordered_set` template std::string getDebugName(std::unordered_set const &set) {