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
555aa1af
Commit
555aa1af
authored
Sep 05, 2013
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug in pattern matchin w/ leading wildcard
parent
e2cf3550
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
cppa/match_expr.hpp
cppa/match_expr.hpp
+17
-6
No files found.
cppa/match_expr.hpp
View file @
555aa1af
...
...
@@ -322,7 +322,9 @@ struct invoke_policy_impl<wildcard_position::leading,
size_t
i
=
tup
.
size
()
-
sizeof
...(
Ts
);
size_t
j
=
0
;
while
(
j
<
sizeof
...(
Ts
))
{
if
(
arr
[
i
++
]
!=
tup
.
type_at
(
j
++
))
return
false
;
if
(
arr
[
j
++
]
!=
tup
.
type_at
(
i
++
))
{
return
false
;
}
}
return
true
;
}
...
...
@@ -494,7 +496,7 @@ Result unroll_expr(PPFPs& fs,
/* recursively evaluate sub expressions */
{
Result
res
=
unroll_expr
<
Result
>
(
fs
,
bitmask
,
long_constant
<
N
-
1
>
{},
type_token
,
is_dynamic
,
ptr
,
tup
);
if
(
res
)
return
res
;
if
(
res
)
return
std
::
move
(
res
)
;
}
if
((
bitmask
&
(
0x01
<<
N
))
==
0
)
return
none
;
auto
&
f
=
get
<
N
>
(
fs
);
...
...
@@ -519,7 +521,10 @@ inline bool can_unroll_expr(PPFPs&, minus1l, const std::type_info&, const Tuple&
}
template
<
class
PPFPs
,
long
N
,
class
Tuple
>
inline
bool
can_unroll_expr
(
PPFPs
&
fs
,
long_constant
<
N
>
,
const
std
::
type_info
&
arg_types
,
const
Tuple
&
tup
)
{
inline
bool
can_unroll_expr
(
PPFPs
&
fs
,
long_constant
<
N
>
,
const
std
::
type_info
&
arg_types
,
const
Tuple
&
tup
)
{
if
(
can_unroll_expr
(
fs
,
long_constant
<
N
-
1l
>
(),
arg_types
,
tup
))
{
return
true
;
}
...
...
@@ -531,12 +536,18 @@ inline bool can_unroll_expr(PPFPs& fs, long_constant<N>, const std::type_info& a
}
template
<
class
PPFPs
,
class
Tuple
>
inline
std
::
uint64_t
calc_bitmask
(
PPFPs
&
,
minus1l
,
const
std
::
type_info
&
,
const
Tuple
&
)
{
inline
std
::
uint64_t
calc_bitmask
(
PPFPs
&
,
minus1l
,
const
std
::
type_info
&
,
const
Tuple
&
)
{
return
0x00
;
}
template
<
class
PPFPs
,
long
N
,
class
Tuple
>
inline
std
::
uint64_t
calc_bitmask
(
PPFPs
&
fs
,
long_constant
<
N
>
,
const
std
::
type_info
&
tinf
,
const
Tuple
&
tup
)
{
inline
std
::
uint64_t
calc_bitmask
(
PPFPs
&
fs
,
long_constant
<
N
>
,
const
std
::
type_info
&
tinf
,
const
Tuple
&
tup
)
{
auto
&
f
=
get
<
N
>
(
fs
);
typedef
typename
util
::
rm_const_and_ref
<
decltype
(
f
)
>::
type
Fun
;
typedef
typename
Fun
::
pattern_type
pattern_type
;
...
...
@@ -779,7 +790,7 @@ class match_expr {
}
inline
size_t
find_token_pos
(
const
std
::
type_info
*
type_token
)
{
for
(
size_t
i
=
m_cache_begin
;
i
!=
m_cache_end
;
++
i
)
{
for
(
size_t
i
=
m_cache_begin
;
i
!=
m_cache_end
;
advance_
(
i
)
)
{
if
(
m_cache
[
i
].
first
==
type_token
)
return
i
;
}
return
m_cache_end
;
...
...
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