Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
9c224ea4
Commit
9c224ea4
authored
Nov 25, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use string_view for atom_from_string
parent
c077fbc0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
libcaf_core/caf/atom.hpp
libcaf_core/caf/atom.hpp
+1
-1
libcaf_core/src/atom.cpp
libcaf_core/src/atom.cpp
+2
-2
No files found.
libcaf_core/caf/atom.hpp
View file @
9c224ea4
...
@@ -40,7 +40,7 @@ std::string to_string(const atom_value& what);
...
@@ -40,7 +40,7 @@ std::string to_string(const atom_value& what);
/// @relates atom_value
/// @relates atom_value
atom_value
to_lowercase
(
atom_value
x
);
atom_value
to_lowercase
(
atom_value
x
);
atom_value
atom_from_string
(
const
std
::
string
&
x
);
atom_value
atom_from_string
(
string_view
x
);
/// Creates an atom from given string literal.
/// Creates an atom from given string literal.
template
<
size_t
Size
>
template
<
size_t
Size
>
...
...
libcaf_core/src/atom.cpp
View file @
9c224ea4
...
@@ -56,11 +56,11 @@ atom_value to_lowercase(atom_value x) {
...
@@ -56,11 +56,11 @@ atom_value to_lowercase(atom_value x) {
return
static_cast
<
atom_value
>
(
detail
::
atom_val
(
buf
.
data
()));
return
static_cast
<
atom_value
>
(
detail
::
atom_val
(
buf
.
data
()));
}
}
atom_value
atom_from_string
(
const
std
::
string
&
x
)
{
atom_value
atom_from_string
(
string_view
x
)
{
if
(
x
.
size
()
>
10
)
if
(
x
.
size
()
>
10
)
return
atom
(
""
);
return
atom
(
""
);
atom_value_buf
buf
;
atom_value_buf
buf
;
memcpy
(
buf
.
data
(),
x
.
c_str
(),
x
.
size
());
memcpy
(
buf
.
data
(),
x
.
data
(),
x
.
size
());
buf
[
x
.
size
()]
=
'\0'
;
buf
[
x
.
size
()]
=
'\0'
;
return
static_cast
<
atom_value
>
(
detail
::
atom_val
(
buf
.
data
()));
return
static_cast
<
atom_value
>
(
detail
::
atom_val
(
buf
.
data
()));
}
}
...
...
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