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
8a5a1225
Commit
8a5a1225
authored
Jan 29, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix `on(<atom constant>)`
parent
f45693a0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
8 deletions
+23
-8
libcaf_core/caf/on.hpp
libcaf_core/caf/on.hpp
+23
-8
No files found.
libcaf_core/caf/on.hpp
View file @
8a5a1225
...
@@ -216,9 +216,18 @@ struct pattern_type_<false, T> {
...
@@ -216,9 +216,18 @@ struct pattern_type_<false, T> {
};
};
template
<
class
T
>
template
<
class
T
>
struct
pattern_type
struct
pattern_type
{
:
pattern_type_
<
using
type
=
detail
::
is_callable
<
T
>::
value
&&
!
detail
::
is_boxed
<
T
>::
value
,
T
>
{
};
typename
pattern_type_
<
detail
::
is_callable
<
T
>::
value
&&
!
detail
::
is_boxed
<
T
>::
value
,
T
>::
type
;
};
template
<
atom_value
V
>
struct
pattern_type
<
atom_constant
<
V
>>
{
using
type
=
atom_value
;
};
}
// namespace detail
}
// namespace detail
}
// namespace caf
}
// namespace caf
...
@@ -302,11 +311,12 @@ constexpr boxed_arg_match_t arg_match = boxed_arg_match_t();
...
@@ -302,11 +311,12 @@ constexpr boxed_arg_match_t arg_match = boxed_arg_match_t();
template
<
class
T
,
typename
Predicate
>
template
<
class
T
,
typename
Predicate
>
std
::
function
<
optional
<
T
>
(
const
T
&
)
>
guarded
(
Predicate
p
,
T
value
)
{
std
::
function
<
optional
<
T
>
(
const
T
&
)
>
guarded
(
Predicate
p
,
T
value
)
{
return
[
=
](
const
T
&
other
)
->
optional
<
T
>
{
return
[
=
](
const
T
&
other
)
->
optional
<
T
>
{
if
(
p
(
other
,
value
))
return
value
;
if
(
p
(
other
,
value
))
{
return
value
;
}
return
none
;
return
none
;
};
};
}
}
// special case covering arg_match as argument to guarded()
// special case covering arg_match as argument to guarded()
...
@@ -344,6 +354,11 @@ F to_guard(F fun,
...
@@ -344,6 +354,11 @@ F to_guard(F fun,
return
fun
;
return
fun
;
}
}
template
<
atom_value
V
>
auto
to_guard
(
const
atom_constant
<
V
>&
)
->
decltype
(
to_guard
(
V
))
{
return
to_guard
(
V
);
}
template
<
class
T
,
class
...
Ts
>
template
<
class
T
,
class
...
Ts
>
auto
on
(
const
T
&
arg
,
const
Ts
&
...
args
)
auto
on
(
const
T
&
arg
,
const
Ts
&
...
args
)
->
detail
::
rvalue_builder
<
->
detail
::
rvalue_builder
<
...
...
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