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
4207c407
Commit
4207c407
authored
May 11, 2014
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
astyle
parent
ff0d3139
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
33 deletions
+33
-33
example.cpp
example/example.cpp
+2
-2
fast_oss.h
include/c11log/details/fast_oss.h
+1
-1
stack_buf.h
include/c11log/details/stack_buf.h
+30
-30
No files found.
example/example.cpp
View file @
4207c407
...
...
@@ -16,8 +16,8 @@ using namespace utils;
int
main
(
int
argc
,
char
*
argv
[])
{
details
::
stack_buf
<
12
>
a
;
details
::
stack_buf
<
12
>
a
;
const
unsigned
int
howmany
=
argc
<=
1
?
1000000
:
atoi
(
argv
[
1
]);
logger
cout_logger
(
"example"
,
sinks
::
stdout_sink
());
...
...
include/c11log/details/fast_oss.h
View file @
4207c407
...
...
@@ -14,7 +14,7 @@ class stack_devicebuf :public std::streambuf
{
public
:
using
Base
=
std
::
streambuf
;
using
stackbuf
=
stack_buf
<
192
>
;
using
stackbuf
=
stack_buf
<
192
>
;
stack_devicebuf
()
=
default
;
~
stack_devicebuf
()
=
default
;
stack_devicebuf
&
operator
=
(
const
stack_devicebuf
&
)
=
delete
;
...
...
include/c11log/details/stack_buf.h
View file @
4207c407
...
...
@@ -15,19 +15,19 @@ template<unsigned short STACK_SIZE>
class
stack_buf
{
public
:
using
bufpair_t
=
std
::
pair
<
const
char
*
,
std
::
size_t
>
;
using
iterator
=
char
const
*
;
static
constexpr
unsigned
short
stack_size
=
STACK_SIZE
;
using
bufpair_t
=
std
::
pair
<
const
char
*
,
std
::
size_t
>
;
using
iterator
=
char
const
*
;
static
constexpr
unsigned
short
stack_size
=
STACK_SIZE
;
stack_buf
()
:
_v
(),
_stack_size
(
0
)
{}
~
stack_buf
()
=
default
;
stack_buf
&
operator
=
(
const
stack_buf
&
other
)
=
delete
;
stack_buf
(
const
stack_buf
&
other
)
:
stack_buf
(
other
,
delegate_copy_move
{})
stack_buf
(
const
stack_buf
&
other
)
:
stack_buf
(
other
,
delegate_copy_move
{})
{}
stack_buf
(
stack_buf
&&
other
)
:
stack_buf
(
other
,
delegate_copy_move
{})
{
stack_buf
(
stack_buf
&&
other
)
:
stack_buf
(
other
,
delegate_copy_move
{})
{
other
.
clear
();
}
...
...
@@ -49,14 +49,14 @@ public:
//Not enough stack space. Copy all to _v
else
{
_v
.
reserve
(
_stack_size
+
buf_size
);
_v
.
insert
(
_v
.
end
(),
_stack_array
.
begin
(),
_stack_array
.
begin
()
+
_stack_size
);
_v
.
reserve
(
_stack_size
+
buf_size
);
_v
.
insert
(
_v
.
end
(),
_stack_array
.
begin
(),
_stack_array
.
begin
()
+
_stack_size
);
_v
.
insert
(
_v
.
end
(),
buf
,
buf
+
buf_size
);
}
}
}
void
clear
()
{
_stack_size
=
0
;
...
...
@@ -71,39 +71,39 @@ public:
return
bufpair_t
(
_stack_array
.
data
(),
_stack_size
);
}
iterator
begin
()
const
{
return
get
().
first
;
}
iterator
begin
()
const
{
return
get
().
first
;
}
iterator
end
()
const
{
bufpair_t
bpair
=
get
();
return
bpair
.
first
+
bpair
.
second
;
}
iterator
end
()
const
{
bufpair_t
bpair
=
get
();
return
bpair
.
first
+
bpair
.
second
;
}
std
::
size_t
size
()
const
{
return
get
().
second
;
return
get
().
second
;
}
private
:
struct
delegate_copy_move
{};
template
<
class
T1
>
stack_buf
(
T1
&&
other
,
delegate_copy_move
)
{
_stack_size
=
other
.
_stack_size
;
struct
delegate_copy_move
{};
template
<
class
T1
>
stack_buf
(
T1
&&
other
,
delegate_copy_move
)
{
_stack_size
=
other
.
_stack_size
;
if
(
other
.
vector_used
())
_v
=
std
::
forward
<
T1
>
(
other
).
_v
;
else
std
::
copy_n
(
other
.
_stack_array
.
begin
(),
other
.
_stack_size
,
_stack_array
.
begin
());
std
::
copy_n
(
other
.
_stack_array
.
begin
(),
other
.
_stack_size
,
_stack_array
.
begin
());
}
inline
bool
vector_used
()
const
{
return
!
(
_v
.
empty
());
}
inline
bool
vector_used
()
const
{
return
!
(
_v
.
empty
());
}
std
::
vector
<
char
>
_v
;
std
::
array
<
char
,
STACK_SIZE
>
_stack_array
;
std
::
size_t
_stack_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