mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
data_type_for() is a function template that converts a C++ type to a database dynamic type (data_type object). Instead of implementing a function per type, implement a variable template instance. This is shorter and nicer. Since the original type variables (e.g. long_type) are defined separately, use a reference instead of copying to avoid initialization order problems. To catch misuses of data_type_for the general data_type_for_v variable template maps to some unused tag type which will cause a build error when instantiated. The original motivation for this was to allow for partial specialization of data_type_for() for tuple types, but this isn't really workable since the native type for tuples is std::vector<data_value>, not std::tuple, and I only checked this after getting the work done, so this isn't helping anything; it's just a little nicer. Closes #13043