1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

Added "Emitter" functor to allow easy emitting of elements of a container

using std::for_each.

llvm-svn: 44589
This commit is contained in:
Ted Kremenek 2007-12-05 00:13:07 +00:00
parent a8e7a09fef
commit f1c4beda54

View File

@ -37,6 +37,17 @@ public:
template <typename T>
inline void Emit(const T& X) { SerializeTrait<T>::Emit(*this,X); }
template <typename T>
struct Emitter {
Serializer &S;
Emitter(Serializer& s) : S(s) {}
void operator()(const T& x) const { S.Emit(x); }
};
template <typename T>
Emitter<T> MakeEmitter() { return Emitter<T>(*this); }
void EmitInt(uint64_t X);
void EmitSInt(int64_t X);