Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
spdlog
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
spdlog
Commits
3d5ee3ff
Commit
3d5ee3ff
authored
May 11, 2014
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small improvments
parent
0948a125
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
fast_oss.h
include/c11log/details/fast_oss.h
+10
-9
No files found.
include/c11log/details/fast_oss.h
View file @
3d5ee3ff
#pragma once
// Faster than ostringstream--returns its string by ref
// A faster-than-ostringstream class
// uses stack_buf as the underlying buffer (upto 192 bytes before using the heap)
#include <ostream>
#include "stack_buf.h"
...
...
@@ -9,12 +11,12 @@ namespace c11log
namespace
details
{
class
stack_devicebuf
:
public
std
::
streambuf
{
public
:
using
Base
=
std
::
streambuf
;
using
stackbuf
=
stack_buf
<
192
>
;
public
:
static
constexpr
unsigned
short
stack_size
=
192
;
using
stackbuf_t
=
stack_buf
<
stack_size
>
;
stack_devicebuf
()
=
default
;
~
stack_devicebuf
()
=
default
;
stack_devicebuf
&
operator
=
(
const
stack_devicebuf
&
)
=
delete
;
...
...
@@ -29,7 +31,7 @@ public:
other
.
clear
();
}
stackbuf
::
bufpair_t
buf
()
const
stackbuf
_t
::
bufpair_t
buf
()
const
{
return
_stackbuf
.
get
();
}
...
...
@@ -62,9 +64,10 @@ protected:
return
ch
;
}
private
:
stackbuf
_stackbuf
;
stackbuf
_t
_stackbuf
;
};
class
fast_oss
:
public
std
::
ostream
{
public
:
...
...
@@ -82,7 +85,6 @@ public:
other
.
clear
();
}
std
::
string
str
()
{
auto
buf
=
_dev
.
buf
();
...
...
@@ -90,7 +92,6 @@ public:
}
std
::
size_t
size
()
const
{
return
_dev
.
size
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment