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
5c0525b7
Commit
5c0525b7
authored
Aug 06, 2014
by
Joseph Noir
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'topic/announce_optionals' into develop
parents
0a86b71c
2b4734b9
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
98 additions
and
87 deletions
+98
-87
libcaf_core/caf/detail/default_uniform_type_info.hpp
libcaf_core/caf/detail/default_uniform_type_info.hpp
+82
-76
libcaf_core/caf/detail/type_traits.hpp
libcaf_core/caf/detail/type_traits.hpp
+10
-0
libcaf_core/caf/on.hpp
libcaf_core/caf/on.hpp
+6
-11
No files found.
libcaf_core/caf/detail/default_uniform_type_info.hpp
View file @
5c0525b7
This diff is collapsed.
Click to expand it.
libcaf_core/caf/detail/type_traits.hpp
View file @
5c0525b7
...
...
@@ -479,6 +479,16 @@ struct type_at<0, T0, Ts...> {
using
type
=
T0
;
};
template
<
class
T
>
struct
is_optional
:
std
::
false_type
{
// no members
};
template
<
class
T
>
struct
is_optional
<
optional
<
T
>>
:
std
::
true_type
{
// no members
};
}
// namespace detail
}
// namespace caf
...
...
libcaf_core/caf/on.hpp
View file @
5c0525b7
...
...
@@ -335,28 +335,23 @@ struct to_guard<anything, false> {
template
<
class
T
>
struct
to_guard
<
detail
::
wrapped
<
T
>
,
false
>
:
to_guard
<
anything
>
{};
template
<
class
T
>
struct
is_optional
:
std
::
false_type
{};
template
<
class
T
>
struct
is_optional
<
optional
<
T
>>
:
std
::
true_type
{};
template
<
class
T
>
struct
to_guard
<
T
,
true
>
{
using
ct
=
typename
detail
::
get_callable_trait
<
T
>::
type
;
using
arg_types
=
typename
ct
::
arg_types
;
static_assert
(
detail
::
tl_size
<
arg_types
>::
value
==
1
,
"projection/guard must take exactly one argument"
);
static_assert
(
is_optional
<
typename
ct
::
result_type
>::
value
,
"projection/guard must return an optional value"
);
"projection/guard must take exactly one argument"
);
static_assert
(
detail
::
is_optional
<
typename
ct
::
result_type
>::
value
,
"projection/guard must return an optional value"
);
using
value_type
=
typename
std
::
conditional
<
std
::
is_function
<
T
>::
value
,
T
*
,
T
>::
type
;
static
value_type
_
(
value_type
val
)
{
return
val
;
}
static
value_type
_
(
value_type
val
)
{
return
val
;
}
};
template
<
class
T
>
...
...
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