[info] typeName = "std::variant" ctype = "STD_VARIANT_TYPE" header = "variant" ns = ["namespace std"] [codegen] decl = """ template void getSizeType(const %1% &container, size_t& returnArg); """ func = """ template void getSizeVariantContents(const %1% &container, size_t& returnArg) { if constexpr (I < sizeof...(Types)) { if (I == container.index()) { // Contents are stored inline - don't double count SAVE_SIZE(-sizeof(std::get(container))); getSizeType(std::get(container), returnArg); } else { getSizeVariantContents(container, returnArg); } } // else variant is valueless - save no data } template void getSizeType(const %1% &container, size_t& returnArg) { SAVE_SIZE(sizeof(%1%)); SAVE_DATA(container.index()); getSizeVariantContents(container, returnArg); } """