g13gui/g13d/repr.h
June Tate-Gans ae6cf5084a g13d: Rework and cleanup namespaces and files
This is the first half of some major rework of the g13d codebase to make things
a bit more manageable. This splits out a great deal of stuff from helper.h into
separate translation units, and also breaks out a great deal of the g13.h header
into separate translation units as well.

Doing this saves in compilation time as we make changes to the system, and also
helps to clean up a whole bunch of leaking symbols.
2021-04-25 16:35:44 -05:00

36 lines
589 B
C++

#ifndef REPR_H
#define REPR_H
#include <string>
#include <ostream>
namespace G13 {
struct string_repr_out {
string_repr_out(const std::string &str) : s(str) {}
void write_on(std::ostream &) const;
std::string s;
};
inline std::ostream &operator<<(std::ostream &o, const string_repr_out &sro) {
sro.write_on(o);
return o;
}
template <class T> inline const T &repr(const T &v) {
return v;
}
inline string_repr_out repr(const char *s) {
return string_repr_out(s);
}
inline string_repr_out repr(const std::string &s) {
return string_repr_out(s);
}
}
#endif // REPR_H