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
68fe080c
Commit
68fe080c
authored
Feb 16, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring
parent
5a913696
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
26 deletions
+11
-26
cppa/detail/matches.hpp
cppa/detail/matches.hpp
+11
-26
No files found.
cppa/detail/matches.hpp
View file @
68fe080c
...
...
@@ -238,21 +238,17 @@ bool matches(std::integral_constant<int, 0>,
typedef
typename
decorated_tuple_from_type_list
<
ptypes
>::
type
dec_t
;
typedef
typename
tuple_vals_from_type_list
<
ptypes
>::
type
tv_t
;
std
::
type_info
const
&
tinfo
=
tpl
.
impl_type
();
auto
j
=
pttrn
.
begin
();
auto
end
=
tpl
.
end
();
if
(
tinfo
==
typeid
(
dec_t
)
||
tinfo
==
typeid
(
tv_t
))
{
if
(
pttrn
.
has_values
())
{
// compare values only (types are guaranteed to be equal)
auto
eq
=
[](
type_value_pair
const
&
lhs
,
type_value_pair
const
&
rhs
)
for
(
auto
i
=
tpl
.
begin
();
i
!=
end
;
++
i
,
++
j
)
{
// pattern (rhs) does not have to have a value
return
rhs
.
second
==
nullptr
||
lhs
.
first
->
equals
(
lhs
.
second
,
rhs
.
second
);
};
if
(
std
::
equal
(
tpl
.
begin
(),
tpl
.
end
(),
pttrn
.
begin
(),
eq
)
==
false
)
{
// values differ
return
false
;
if
(
j
->
second
!=
nullptr
&&
i
->
first
->
equals
(
i
->
second
,
j
->
second
)
==
false
)
return
false
;
}
}
}
...
...
@@ -261,30 +257,19 @@ bool matches(std::integral_constant<int, 0>,
if
(
pttrn
.
has_values
())
{
// compares type and value
auto
eq
=
[](
type_value_pair
const
&
lhs
,
type_value_pair
const
&
rhs
)
{
// pattern (rhs) does not have to have a value
return
lhs
.
first
==
rhs
.
first
&&
(
rhs
.
second
==
nullptr
||
lhs
.
first
->
equals
(
lhs
.
second
,
rhs
.
second
));
};
if
(
std
::
equal
(
tpl
.
begin
(),
tpl
.
end
(),
pttrn
.
begin
(),
eq
)
==
false
)
for
(
auto
i
=
tpl
.
begin
();
i
!=
end
;
++
i
,
++
j
)
{
// types or values differ
return
false
;
if
(
i
->
first
!=
j
->
first
||
(
j
->
second
!=
nullptr
&&
i
->
first
->
equals
(
i
->
second
,
j
->
second
)
==
false
))
return
false
;
}
}
else
{
// compares the types only
auto
eq
=
[](
type_value_pair
const
&
lhs
,
type_value_pair
const
&
rhs
)
{
return
lhs
.
first
==
rhs
.
first
;
};
if
(
std
::
equal
(
tpl
.
begin
(),
tpl
.
end
(),
pttrn
.
begin
(),
eq
)
==
false
)
for
(
auto
i
=
tpl
.
begin
();
i
!=
end
;
++
i
,
++
j
)
{
// types differ
return
false
;
if
(
i
->
first
!=
j
->
first
)
return
false
;
}
}
}
...
...
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