I'm getting a stack overflow runtime exception when I declare my struct json_schema_sync_response_t. I've included the full definition below. I don't understand why I'm getting this error. Could someone please help me out? I've reduced it to the line with the comment besides it. Thanks!
#ifndef HTTP_JSON_SCHEMAS_H
#define HTTP_JSON_SCHEMAS_H
#include <string>
#include <array>
typedef struct json_schema_device_t json_schema_device_t;
typedef struct json_schema_zone_t json_schema_zone_t;
typedef struct json_schema_region_t json_schema_region_t;
typedef struct json_schema_sync_response_t json_schema_sync_response_t;
// https://stackoverflow.com/questions/888386/resolve-circular-typedef-dependency
struct json_schema_device_t {
int id;
std::string macAddress;
};
struct json_schema_zone_t {
int deviceCount = 0;
std::array<json_schema_device_t, 20> devices; // this produces a stack overflow on declaration
};
struct json_schema_region_t {
int zoneCount = 0;
std::array<json_schema_zone_t, 14> zones;
int deviceCount = 0;
std::array<json_schema_device_t, 20> devices;
};
struct json_schema_sync_response_t {
bool success;
std::string gatewayToken;
int regionCount = 0;
std::array<json_schema_region_t, 5> regions;
};
#endif