Variable ros2_medkit_gateway::dto::dto_fields

Variable Documentation

template<class T>
constexpr detail::not_a_dto<T> *ros2_medkit_gateway::dto::dto_fields = nullptr

Primary template: a sentinel pointer. Specialize per DTO with std::make_tuple(field(…), …).

IMPORTANT: every dto_fields<X> / dto_name<X> specialization MUST be co-located in the header that declares X. A TU that instantiates a visitor before seeing the specialization would otherwise silently bind this sentinel (latent ODR-adjacent bug); the static_assert inside for_each_field surfaces that misuse as a compile error at the point where a visitor actually tries to walk the (missing) field tuple.

IMPORTANT: a DTO must not transitively contain itself BY VALUE (infinite template recursion) - use std::optional / std::vector / nlohmann::json for any recursive shape.

IMPLEMENTATION NOTE: the primary holds a pointer to not_a_dto<T> rather than a value. This keeps decltype(dto_fields<T>) well-formed for any T without forcing instantiation of detail::not_a_dto<T>, and it gives is_dto_v<T> a stable type identity to compare against.