12 namespace alps {
namespace alea {
namespace internal {
17 namespace alps {
namespace alea {
namespace internal {
40 saved_.copyfmt(stream_);
46 stream_.copyfmt(saved_);
49 std::ios::fmtflags
saved_flags()
const {
return saved_.flags(); }
51 std::ostream &
stream() {
return stream_; }
53 const std::ostream &
stream()
const {
return stream_; }
60 std::ostream &stream_;
90 T &
get_format(std::ios_base &stream, T initial_value = T())
105 template <
typename T>
110 static T &
get(std::ios_base &stream, T init = T())
115 if (format ==
nullptr) {
116 format =
new T(init);
117 stream.register_callback(callback, get_xindex());
123 static void remove(std::ios_base &stream)
125 callback(std::ios::erase_event, stream, get_xindex());
130 static void callback(std::ios::event event, std::ios_base &stream,
133 if (xindex != get_xindex()) { assert(
false); }
137 case std::ios::erase_event:
144 case std::ios::copyfmt_event:
152 case std::ios::imbue_event:
160 return reinterpret_cast<T *&
>(stream.pword(get_xindex()));
169 static int xindex = std::ios_base::xalloc();
std::ios::fmtflags saved_flags() const
T & get_format(std::ios_base &stream, T initial_value=T())
const std::ostream & stream() const
format_sentry(std::ostream &str)