Boost logo

Boost :

Subject: Re: [boost] [variant] awkward recursion
From: Agustín K-ballo Bergé (kaballo86_at_[hidden])
Date: 2012-10-29 16:18:23


On 29/10/2012 04:29 p.m., Dave Abrahams wrote:
> In the abstract, json looks like:
>
> struct null {};
> typedef std::map<std::string, value> object;
> typedef std::vector<value> array;
>
> typedef variant<
> null, std::string, double, object, array, bool
> > value;

Keep in mind that instantiating a standard container with an incomplete
type will yield undefined behavior, and that `variant` has to
instantiate both `object` and `array` to know their size. In my own JSON
attempt I have used Boost.Containers, which do guarantee defined
behavior when instantiated with incomplete types.

Agustín K-ballo Bergé.-
http://fusionfenix.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk