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
69bb2c9f
Unverified
Commit
69bb2c9f
authored
Oct 02, 2018
by
Dominik Charousset
Committed by
GitHub
Oct 02, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #768
Fix dictionary emplace with char array
parents
cb4f6977
3bb24251
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
libcaf_core/caf/dictionary.hpp
libcaf_core/caf/dictionary.hpp
+5
-0
libcaf_core/test/dictionary.cpp
libcaf_core/test/dictionary.cpp
+7
-0
No files found.
libcaf_core/caf/dictionary.hpp
View file @
69bb2c9f
...
@@ -290,6 +290,11 @@ private:
...
@@ -290,6 +290,11 @@ private:
return
std
::
lower_bound
(
from
,
end
(),
key
,
cmp
);
return
std
::
lower_bound
(
from
,
end
(),
key
,
cmp
);
}
}
template
<
size_t
N
>
static
inline
std
::
string
copy
(
const
char
(
&
str
)[
N
])
{
return
std
::
string
{
str
};
}
// Copies the content of `str` into a new string.
// Copies the content of `str` into a new string.
static
inline
std
::
string
copy
(
string_view
str
)
{
static
inline
std
::
string
copy
(
string_view
str
)
{
return
std
::
string
{
str
.
begin
(),
str
.
end
()};
return
std
::
string
{
str
.
begin
(),
str
.
end
()};
...
...
libcaf_core/test/dictionary.cpp
View file @
69bb2c9f
...
@@ -79,6 +79,13 @@ CAF_TEST(swapping) {
...
@@ -79,6 +79,13 @@ CAF_TEST(swapping) {
CAF_CHECK_NOT_EQUAL
(
xs
,
zs
);
CAF_CHECK_NOT_EQUAL
(
xs
,
zs
);
}
}
CAF_TEST
(
emplacing
)
{
int_dict
xs
;
CAF_CHECK_EQUAL
(
xs
.
emplace
(
"x"
,
1
).
second
,
true
);
CAF_CHECK_EQUAL
(
xs
.
emplace
(
"y"
,
2
).
second
,
true
);
CAF_CHECK_EQUAL
(
xs
.
emplace
(
"y"
,
3
).
second
,
false
);
}
CAF_TEST
(
insertion
)
{
CAF_TEST
(
insertion
)
{
int_dict
xs
;
int_dict
xs
;
CAF_CHECK_EQUAL
(
xs
.
insert
(
"a"
,
1
).
second
,
true
);
CAF_CHECK_EQUAL
(
xs
.
insert
(
"a"
,
1
).
second
,
true
);
...
...
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