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
4f2dd639
Commit
4f2dd639
authored
Sep 06, 2013
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
matches.hpp: streamlined static assertion
parent
5a7db4aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
cppa/detail/matches.hpp
cppa/detail/matches.hpp
+12
-8
No files found.
cppa/detail/matches.hpp
View file @
4f2dd639
...
@@ -140,14 +140,13 @@ struct matcher<wildcard_position::in_between, Tuple, T...> {
...
@@ -140,14 +140,13 @@ struct matcher<wildcard_position::in_between, Tuple, T...> {
static
constexpr
size_t
size
=
sizeof
...(
T
);
static
constexpr
size_t
size
=
sizeof
...(
T
);
static
constexpr
size_t
wc_pos
=
static_cast
<
size_t
>
(
signed_wc_pos
);
static
constexpr
size_t
wc_pos
=
static_cast
<
size_t
>
(
signed_wc_pos
);
static_assert
(
signed_wc_pos
!=
-
1
static_assert
(
signed_wc_pos
>
0
&&
signed_wc_pos
!=
0
&&
signed_wc_pos
<
(
sizeof
...(
T
)
-
1
),
&&
signed_wc_pos
!=
(
sizeof
...(
T
)
-
1
),
"illegal wildcard position"
);
"illegal wildcard position"
);
static
inline
bool
tmatch
(
const
Tuple
&
tup
)
{
static
inline
bool
tmatch
(
const
Tuple
&
tup
)
{
auto
tup_size
=
tup
.
size
();
auto
tup_size
=
tup
.
size
();
if
(
tup_size
>=
size
)
{
if
(
tup_size
>=
(
size
-
1
)
)
{
auto
&
tarr
=
static_types_array
<
T
...
>::
arr
;
auto
&
tarr
=
static_types_array
<
T
...
>::
arr
;
// first range [0, X1)
// first range [0, X1)
auto
begin
=
tup
.
begin
();
auto
begin
=
tup
.
begin
();
...
@@ -245,9 +244,14 @@ struct matcher<wildcard_position::multiple, Tuple, T...> {
...
@@ -245,9 +244,14 @@ struct matcher<wildcard_position::multiple, Tuple, T...> {
auto
fpush
=
[
&
](
const
typename
Tuple
::
const_iterator
&
iter
)
{
auto
fpush
=
[
&
](
const
typename
Tuple
::
const_iterator
&
iter
)
{
mv
.
push_back
(
iter
.
position
());
mv
.
push_back
(
iter
.
position
());
};
};
auto
fcommit
=
[
&
]()
{
commited_size
=
mv
.
size
();
};
auto
fcommit
=
[
&
]
{
auto
frollback
=
[
&
]()
{
mv
.
resize
(
commited_size
);
};
commited_size
=
mv
.
size
();
return
match
(
tup
.
begin
(),
tup
.
end
(),
tarr
.
begin
(),
tarr
.
end
(),
};
auto
frollback
=
[
&
]
{
mv
.
resize
(
commited_size
);
};
return
match
(
tup
.
begin
(),
tup
.
end
(),
tarr
.
begin
(),
tarr
.
end
(),
fpush
,
fcommit
,
frollback
);
fpush
,
fcommit
,
frollback
);
}
}
return
false
;
return
false
;
...
@@ -290,7 +294,7 @@ struct match_impl_from_type_list;
...
@@ -290,7 +294,7 @@ struct match_impl_from_type_list;
template
<
class
Tuple
,
typename
...
Ts
>
template
<
class
Tuple
,
typename
...
Ts
>
struct
match_impl_from_type_list
<
Tuple
,
util
::
type_list
<
Ts
...
>
>
{
struct
match_impl_from_type_list
<
Tuple
,
util
::
type_list
<
Ts
...
>
>
{
typedef
match_impl
<
get_wildcard_position
<
util
::
type_list
<
Ts
...
>
>
(),
typedef
match_impl
<
get_wildcard_position
<
util
::
type_list
<
Ts
...
>>
(),
Tuple
,
Tuple
,
Ts
...
>
Ts
...
>
type
;
type
;
...
...
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