[test-utils] Make a template for outputting any optional.
This commit is contained in:
parent
b0d1fa0851
commit
49da293be9
@ -91,16 +91,6 @@ namespace persistent_data {
|
||||
bool damaged_;
|
||||
block_address damage_begin_;
|
||||
};
|
||||
|
||||
inline
|
||||
std::ostream &operator <<(std::ostream &out, damage_tracker::maybe_range64 const &mr) {
|
||||
if (mr)
|
||||
out << "Just " << *mr;
|
||||
else
|
||||
out << "Nothing";
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
@ -109,6 +109,18 @@ namespace test {
|
||||
|
||||
std::auto_ptr<with_directory> dir_;
|
||||
};
|
||||
|
||||
//--------------------------------
|
||||
|
||||
template <typename T>
|
||||
std::ostream &operator <<(std::ostream &out, boost::optional<T> const &maybe) {
|
||||
if (maybe)
|
||||
out << "Just [" << *maybe << "]";
|
||||
else
|
||||
out << "Nothing";
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user