LLVM 20.0.0git
|
Simple wrapper around std::function<void(raw_ostream&)>. More...
#include "llvm/Support/Printable.h"
Public Member Functions | |
Printable (std::function< void(raw_ostream &OS)> Print) | |
Public Attributes | |
std::function< void(raw_ostream &OS)> | |
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.
|
inline |
Definition at line 41 of file Printable.h.
std::function<void(raw_ostream &OS)> llvm::Printable::Print |
Definition at line 40 of file Printable.h.