feat(const): added << operator to constant so that constants
also added tests for the stream operator
This commit is contained in:
@@ -16,6 +16,16 @@ struct constant {
|
||||
double uncertainty; ///< Uncertainty in the constant's value
|
||||
std::string unit; ///< Unit of the constant
|
||||
std::string reference; ///< Reference for the constant's value
|
||||
|
||||
/**
|
||||
* @brief overload the << operator for pretty printing
|
||||
*/
|
||||
friend std::ostream& operator<<(std::ostream& os, const constant& c) {
|
||||
os << "<" << c.name << ": ";
|
||||
os << c.value << "±" << c.uncertainty << " ";
|
||||
os << c.unit << " (" << c.reference << ")>\n";
|
||||
return os;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user