bernedom / SI

A header only C++ library that provides type safety and user defined literals for physical units
https://si.dominikberner.ch/doc/
MIT License
486 stars 40 forks source link

Inserting a space between the value and the symbol (ofstream overload operator and SI::to_string() function) #108

Closed sergioferrari closed 2 years ago

sergioferrari commented 2 years ago

Personally in the output stream (include file: ) I would insert a space between the value and the symbol of the variable so that it looks like this:

SI::kilo_gram_t mymass(3.2);
std::cout << mymass << std::endl;
// output: 3.2 kg

The same applies to overloading the to_string() function

bernedom commented 2 years ago

You are right. This is even described in section 5.4.2 of the SI brochure :

The numerical value always precedes the unit and a space is always used to separate the unit from the number

Will fix it as soon as I find the time for it