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
a6585202
Commit
a6585202
authored
Nov 11, 2015
by
Matthias Vallentin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing overload for maybe<void>
parent
dd56fb88
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
libcaf_core/caf/maybe.hpp
libcaf_core/caf/maybe.hpp
+17
-0
libcaf_core/test/maybe.cpp
libcaf_core/test/maybe.cpp
+6
-0
No files found.
libcaf_core/caf/maybe.hpp
View file @
a6585202
...
@@ -421,6 +421,14 @@ public:
...
@@ -421,6 +421,14 @@ public:
// nop
// nop
}
}
template
<
class
E
,
class
=
typename
std
::
enable_if
<
std
::
is_error_condition_enum
<
E
>
::
value
>::
type
>
maybe
(
E
error_code_enum
)
:
error_
{
error_code_enum
}
{
// nop
}
maybe
&
operator
=
(
const
none_t
&
)
{
maybe
&
operator
=
(
const
none_t
&
)
{
error_
.
clear
();
error_
.
clear
();
return
*
this
;
return
*
this
;
...
@@ -431,6 +439,15 @@ public:
...
@@ -431,6 +439,15 @@ public:
return
*
this
;
return
*
this
;
}
}
template
<
class
E
,
class
=
typename
std
::
enable_if
<
std
::
is_error_condition_enum
<
E
>
::
value
>::
type
>
maybe
&
operator
=
(
E
error_code_enum
)
{
error_
=
error_code_enum
;
return
*
this
;
}
bool
available
()
const
{
bool
available
()
const
{
return
false
;
return
false
;
}
}
...
...
libcaf_core/test/maybe.cpp
View file @
a6585202
...
@@ -104,4 +104,10 @@ CAF_TEST(maybe_void) {
...
@@ -104,4 +104,10 @@ CAF_TEST(maybe_void) {
CAF_CHECK
(
!
m
.
empty
());
CAF_CHECK
(
!
m
.
empty
());
CAF_CHECK
(
m
.
error
());
CAF_CHECK
(
m
.
error
());
CAF_CHECK
(
m
.
error
()
==
std
::
errc
::
invalid_argument
);
CAF_CHECK
(
m
.
error
()
==
std
::
errc
::
invalid_argument
);
// Implicit construction.
auto
f
=
[]()
->
maybe
<
void
>
{
return
std
::
errc
::
invalid_argument
;
};
auto
val
=
f
();
CAF_CHECK
(
!
val
&&
val
.
error
()
==
std
::
errc
::
invalid_argument
);
}
}
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