Typedef Circular Dependency

Viewed 1746

How can I solve the following circular dependency?

typedef boost::variant<int, bool, double, std::string, Structure> Value;
typedef std::list<std::pair<std::string, ValueContainer>> Structure;
typedef std::vector<Value> ValueContainer;

I'm attempting to represent objects from a C api database library in a more C++ form. This database allows one to store values or arrays of values, as well as having a representation for Structures, as follows:

typedef struct ApiStructureMember 
{
    char* name;
    struct ApiValueContainer value;
    struct ApiStructureMember_T* next;
} ApiStructureMember_T;

Finally, a union is used to represent a value, as follows:

typedef struct ApiValue 
{
    union 
    {
        int i;
        const char*   s;
        ...
        struct ApiStructureMember_T* firstStructureMember;
    } value;
} ApiValue_T; 
2 Answers
Related