2022-12-19 14:37:51 +00:00
|
|
|
[info]
|
2023-05-23 22:26:38 +01:00
|
|
|
type_name = "std::pair"
|
2022-12-19 14:37:51 +00:00
|
|
|
ctype = "PAIR_TYPE"
|
|
|
|
header = "utility"
|
2023-05-23 22:26:38 +01:00
|
|
|
|
|
|
|
# Old:
|
|
|
|
typeName = "std::pair<"
|
2022-12-19 14:37:51 +00:00
|
|
|
ns = ["namespace std"]
|
2023-05-23 22:26:38 +01:00
|
|
|
numTemplateParams = 2
|
2022-12-19 14:37:51 +00:00
|
|
|
replaceTemplateParamIndex = []
|
|
|
|
|
|
|
|
[codegen]
|
|
|
|
decl = """
|
|
|
|
template<typename P, typename Q>
|
2023-05-23 22:26:38 +01:00
|
|
|
void getSizeType(const %1%<P,Q> &container, size_t& returnArg);
|
2022-12-19 14:37:51 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
func = """
|
|
|
|
template<typename P, typename Q>
|
2023-05-23 22:26:38 +01:00
|
|
|
void getSizeType(const %1%<P,Q> &container, size_t& returnArg)
|
2022-12-19 14:37:51 +00:00
|
|
|
{
|
|
|
|
SAVE_SIZE(sizeof(%1%<P,Q>) - sizeof(P) - sizeof(Q));
|
|
|
|
|
2023-05-23 22:26:38 +01:00
|
|
|
getSizeType(container.first, returnArg);
|
|
|
|
getSizeType(container.second, returnArg);
|
2022-12-19 14:37:51 +00:00
|
|
|
}
|
|
|
|
"""
|
2023-04-20 17:52:58 +01:00
|
|
|
|
2023-08-16 20:40:36 +01:00
|
|
|
traversal_func = """
|
2023-11-16 15:34:03 +00:00
|
|
|
return OIInternal::getSizeType<Ctx>(ctx,
|
2023-08-16 20:40:36 +01:00
|
|
|
container.second,
|
2023-11-16 15:34:03 +00:00
|
|
|
returnArg.delegate([&ctx, &container](auto ret) {
|
|
|
|
return OIInternal::getSizeType<Ctx>(ctx, container.first, ret);
|
2023-08-16 20:40:36 +01:00
|
|
|
})
|
|
|
|
);
|
|
|
|
"""
|
|
|
|
|
|
|
|
[[codegen.processor]]
|
2023-11-15 19:28:21 +00:00
|
|
|
type = "types::st::Pair<DB, typename TypeHandler<Ctx, T0>::type, typename TypeHandler<Ctx, T1>::type>"
|
2023-08-16 20:40:36 +01:00
|
|
|
func = """
|
2023-11-15 19:28:21 +00:00
|
|
|
static constexpr auto firstField = make_field<Ctx, T0>("first");
|
|
|
|
static constexpr auto secondField = make_field<Ctx, T1>("second");
|
2023-08-16 20:40:36 +01:00
|
|
|
|
|
|
|
el.exclusive_size = sizeof(std::pair<T0, T1>) - sizeof(T0) - sizeof(T1);
|
2023-09-14 16:09:23 +01:00
|
|
|
stack_ins(secondField);
|
|
|
|
stack_ins(firstField);
|
2023-08-16 20:40:36 +01:00
|
|
|
"""
|