13 template <
typename Tr,
typename Ta>
void add_attribute(Tr &r, Ta v)
15 using Tc =
typename Tr::template check_type<Ta>;
16 static_assert(Tc::value);
19 if constexpr (std::is_enum_v<Ta>)
20 r.attributes.emplace_back(
id, std::to_string(
static_cast<int>(v)));
22 r.attributes.emplace_back(
id, attr_to_string(v));
26 unsigned int get_or_create_attribute_name(
const std::string &name);
28 void write_attributes(std::ostream &ost,
const std::string &prefix =
"")
const;
32 unsigned int get_or_create_attribute_text(
const std::string &name);
34 static std::string double_to_string(
double v,
unsigned int n);
38 return double_to_string(a.value, a.ndigits);
48 return std::to_string(get_or_create_attribute_text(a.value));
52 std::map<std::string, unsigned int> attribute_names;
53 std::map<std::string, unsigned int> attribute_texts;
Definition attributes.hpp:25