CopyTable
actually works for this purpose, it can copy from an existing buffer into a different builder. But it requires reflection, which is very clumsy, and I'd recommend against using it.
If you really can't construct C in one go, the best alternative is to change the flata
field into flata : [ubyte] (nested_flatbuffer: "Flat_A")
. You can copy the entire serialized bytes of A into flata
, and you can then access it by getting the root of flata
(there should be an accessor generated for you that does this automatically). This is actually almost as efficient as having a Flat_A
type directly, since it is still accessing this nested buffer in place.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…