Subject: Re: [boost] [variant] awkward recursion
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-10-29 16:43:35
on Mon Oct 29 2012, Dave Abrahams <dave-AT-boostpro.com> wrote:
> I've been playing around with variant a bit and decided to try to build
> a data structure for storing json. I came up with several different
> approaches but none are super-satisfying. I'd like some feedback. (If
> you need a refresher on what's in json, the front page of
> http://json.org tells all).
I got *some* answers to my questions by experimentation: https://gist.github.com/3976374
size of objects: 48, 48, 48
size of arrays: 24, 24, 24
size of variants: 56, 16, 16
What I learned is that using either recursive_wrapper or
recursive_variant_ *does* seem to introduce an indirection even if one
isn't needed. I also learned that 8 bytes are used for a discriminant
on my x64 system, which I'll grudgingly admit might be the best we can
do. But only grudgingly.
Comments on other questions in that message are still appreciated.
-- Dave Abrahams BoostPro Computing Software Development Training http://www.boostpro.com Clang/LLVM/EDG Compilers C++ Boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk