mapbox / variant

C++11/C++14 Variant
BSD 3-Clause "New" or "Revised" License
371 stars 100 forks source link

How can I make the recursive variant serializable? #169

Closed iomeone closed 5 years ago

iomeone commented 5 years ago

Thank you for the library, I just want some advice which is the best way to serialize it to the string and restore the variant from the string , thank you very much!

artemp commented 5 years ago

@iomeone - the best way is subjective here and depends on your actual types. I'd start by looking how boost::variant implements serialisation for recursive types. If you're OK with a plain text then JSON or YAML might be a good solution. HTH

iomeone commented 5 years ago

I see, and I will recursively tranverse the datatype, and translate it to plain text, thanks anyway!