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
c516ac55
Commit
c516ac55
authored
May 10, 2014
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stack_buf improvement after code review
parent
0f919304
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
stack_buf.h
include/c11log/details/stack_buf.h
+6
-8
No files found.
include/c11log/details/stack_buf.h
View file @
c516ac55
...
...
@@ -24,10 +24,10 @@ public:
stack_buf
&
operator
=
(
const
stack_buf
&
other
)
=
delete
;
stack_buf
(
const
stack_buf
&
other
)
:
stack_buf
(
other
,
false
)
stack_buf
(
const
stack_buf
&
other
)
:
stack_buf
(
other
,
delegate_copy_move
{}
)
{}
stack_buf
(
stack_buf
&&
other
)
:
stack_buf
(
other
,
true
)
stack_buf
(
stack_buf
&&
other
)
:
stack_buf
(
other
,
delegate_copy_move
{}
)
{
other
.
clear
();
}
...
...
@@ -44,7 +44,7 @@ public:
{
if
(
_stack_size
+
buf_size
<=
STACK_SIZE
)
{
std
::
memcpy
(
&
_stack_array
[
_stack_size
],
buf
,
buf_size
);
std
::
memcpy
(
&
_stack_array
[
_stack_size
],
buf
,
buf_size
);
_stack_size
+=
buf_size
;
}
//Not enough stack space. Copy all to _v
...
...
@@ -89,15 +89,13 @@ public:
}
private
:
struct
delegate_copy_move
{};
template
<
class
T1
>
stack_buf
(
T1
&&
other
,
bool
is_rval
)
stack_buf
(
T1
&&
other
,
delegate_copy_move
)
{
_stack_size
=
other
.
_stack_size
;
if
(
other
.
vector_used
())
{
_v
=
is_rval
?
std
::
move
(
other
.
_v
)
:
other
.
_v
;
//_v = std::forward<T1>(other)._v;
}
_v
=
std
::
forward
<
T1
>
(
other
).
_v
;
else
std
::
copy_n
(
other
.
_stack_array
.
begin
(),
other
.
_stack_size
,
_stack_array
.
begin
());
}
...
...
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