| 58 | |
| 59 | template <typename T> |
| 60 | inline bool ArrayData::addValue(const T& value, ResourceManager* resources) { |
| 61 | ARDUINOJSON_ASSERT(resources != nullptr); |
| 62 | auto slot = resources->allocVariant(); |
| 63 | if (!slot) |
| 64 | return false; |
| 65 | JsonVariant variant(slot.ptr(), resources); |
| 66 | if (!variant.set(value)) { |
| 67 | resources->freeVariant(slot); |
| 68 | return false; |
| 69 | } |
| 70 | CollectionData::appendOne(slot, resources); |
| 71 | return true; |
| 72 | } |
| 73 | |
| 74 | // Returns the size (in bytes) of an array with n elements. |
| 75 | constexpr size_t sizeofArray(size_t n) { |
no test coverage detected