2
0
mirror of https://github.com/gabime/spdlog.git synced 2024-12-21 08:10:43 +08:00

pass by ref bugfix

This commit is contained in:
gabi 2014-10-18 19:03:41 +03:00
parent 21065ec036
commit b36a803469
3 changed files with 5 additions and 7 deletions
include/c11log

View File

@ -7,7 +7,7 @@
#include <iomanip>
#include "fast_istostr.h"
#include "stack_buf.h"
#include<iostream>
namespace c11log
{
@ -81,8 +81,6 @@ public:
fast_oss() :std::ostream(&_dev) {}
~fast_oss() = default;
fast_oss(const fast_oss& other) :std::basic_ios<char>(), std::ostream(&_dev), _dev(other._dev)
{}
@ -108,7 +106,7 @@ public:
std::string str()
{
auto buffer = _dev.buf();
auto& buffer = _dev.buf();
const char*data = buffer.data();
return std::string(data, data+buffer.size());
}
@ -152,7 +150,7 @@ public:
void write_fast_oss(const fast_oss& oss)
{
auto buffer = oss.buf();
auto& buffer = oss.buf();
_dev.sputn(buffer.data(), buffer.size());
}

View File

@ -18,7 +18,7 @@ public:
void write(const log_msg& msg, std::ofstream& ofs)
{
auto buf = msg.formatted.buf();
auto& buf = msg.formatted.buf();
ofs.write(buf.data(), buf.size());
if(--_flush_countdown == 0)
{

View File

@ -24,7 +24,7 @@ public:
protected:
virtual void _sink_it(const details::log_msg& msg) override
{
auto buf = msg.formatted.buf();
auto& buf = msg.formatted.buf();
_ostream.write(buf.data(), buf.size());
}
std::ostream& _ostream;