[
https://issues.apache.org/jira/browse/AVRO-855?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15853924#comment-15853924
]
Darryl Green commented on AVRO-855:
-----------------------------------
I've had a play with implementing this in a way that doesn't change the API
i.e. the getters setters interface remains, its only the impl that changes to
use a variant. You can access the variant itself explicitly (unless I add a set
of forwarding templates - which might be practical) to use visitor interface
etc. However, until/unless I wrap everything in recursive wrappers (which won't
do good things for the efficiency gains variant should otherwise have offered
over any) the recursive union test won't compile. It would be preferable
annotate which types are recursive and need a recursive wrapper (or maybe use
a unique_ptr), while allowing non-recursive types (simple, fast ones) to be
simple and fast... But annotations support is something that isn't there yet in
the cpp parser?
> Use boost:variants for union types in C++ code generation
> ---------------------------------------------------------
>
> Key: AVRO-855
> URL: https://issues.apache.org/jira/browse/AVRO-855
> Project: Avro
> Issue Type: Improvement
> Components: c++
> Affects Versions: 1.5.1
> Reporter: Ramana Suvarapu
> Labels: avro, c++
>
> Hi,
> Current C++ code avrocodegencpp generates union_n (where n = 0 to n numbered)
> structure with the member boost::any for union schemas.
> Is it possible to use boost::variants instead of "union_n" structures? The
> advantage of boost::variant is we can define our boost::visitors and apply
> them to retrieve the actual type in the union.
> Let me know?
> -Ramana
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)