LLVM: llvm::Printable Class Reference (original) (raw)
Simple wrapper around std::function<void(raw_ostream&)>.
This class is useful to construct print helpers for raw_ostream.
Example: Printable printRegister(unsigned Register) { return Printable([Register](raw_ostream &OS) { OS << getRegisterName(Register); }); } ... OS << printRegister(Register); ...
Implementation note: Ideally this would just be a typedef, but doing so leads to operator << being ambiguous as function has matching constructors in some STL versions. I have seen the problem on gcc 4.6 libstdc++ and microsoft STL.
Definition at line 38 of file Printable.h.