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
129e05ad
Commit
129e05ad
authored
Jan 01, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support 'val<type>' syntax in patterns
parent
89b9ff7f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
2 deletions
+44
-2
cppa/detail/boxed.hpp
cppa/detail/boxed.hpp
+16
-0
cppa/detail/tdata.hpp
cppa/detail/tdata.hpp
+8
-0
cppa/detail/unboxed.hpp
cppa/detail/unboxed.hpp
+18
-0
cppa/on.hpp
cppa/on.hpp
+1
-1
unit_testing/test__pattern.cpp
unit_testing/test__pattern.cpp
+1
-1
No files found.
cppa/detail/boxed.hpp
View file @
129e05ad
...
@@ -66,7 +66,23 @@ struct is_boxed< util::wrapped<T> >
...
@@ -66,7 +66,23 @@ struct is_boxed< util::wrapped<T> >
static
const
bool
value
=
true
;
static
const
bool
value
=
true
;
};
};
template
<
typename
T
>
struct
is_boxed
<
util
::
wrapped
<
T
>
()
>
{
static
const
bool
value
=
true
;
};
template
<
typename
T
>
struct
is_boxed
<
util
::
wrapped
<
T
>
(
&
)()
>
{
static
const
bool
value
=
true
;
};
template
<
typename
T
>
struct
is_boxed
<
util
::
wrapped
<
T
>
(
*
)()
>
{
static
const
bool
value
=
true
;
};
}
}
// namespace cppa::detail
}
}
// namespace cppa::detail
...
...
cppa/detail/tdata.hpp
View file @
129e05ad
...
@@ -99,6 +99,14 @@ struct tdata<Head, Tail...> : tdata<Tail...>
...
@@ -99,6 +99,14 @@ struct tdata<Head, Tail...> : tdata<Tail...>
{
{
}
}
// allow initialization with a function pointer or reference
// returning a wrapped<Head>
template
<
typename
...
Args
>
tdata
(
util
::
wrapped
<
Head
>
(
*
)(),
Args
const
&
...
vals
)
:
super
(
vals
...),
head
()
{
}
inline
tdata
<
Tail
...
>&
tail
()
inline
tdata
<
Tail
...
>&
tail
()
{
{
// upcast
// upcast
...
...
cppa/detail/unboxed.hpp
View file @
129e05ad
...
@@ -47,6 +47,24 @@ struct unboxed< util::wrapped<T> >
...
@@ -47,6 +47,24 @@ struct unboxed< util::wrapped<T> >
typedef
typename
util
::
wrapped
<
T
>::
type
type
;
typedef
typename
util
::
wrapped
<
T
>::
type
type
;
};
};
template
<
typename
T
>
struct
unboxed
<
util
::
wrapped
<
T
>
(
&
)()
>
{
typedef
typename
util
::
wrapped
<
T
>::
type
type
;
};
template
<
typename
T
>
struct
unboxed
<
util
::
wrapped
<
T
>
()
>
{
typedef
typename
util
::
wrapped
<
T
>::
type
type
;
};
template
<
typename
T
>
struct
unboxed
<
util
::
wrapped
<
T
>
(
*
)()
>
{
typedef
typename
util
::
wrapped
<
T
>::
type
type
;
};
}
}
// namespace cppa::detail
}
}
// namespace cppa::detail
#endif // UNBOXED_HPP
#endif // UNBOXED_HPP
cppa/on.hpp
View file @
129e05ad
...
@@ -98,8 +98,8 @@ class invoke_rule_builder
...
@@ -98,8 +98,8 @@ class invoke_rule_builder
template
<
typename
...
Args
>
template
<
typename
...
Args
>
invoke_rule_builder
(
Args
const
&
...
args
)
invoke_rule_builder
(
Args
const
&
...
args
)
:
m_pattern
(
new
pattern_type
(
args
...))
{
{
m_pattern
.
reset
(
new
pattern_type
(
args
...));
}
}
template
<
typename
F
>
template
<
typename
F
>
...
...
unit_testing/test__pattern.cpp
View file @
129e05ad
...
@@ -68,7 +68,7 @@ size_t test__pattern()
...
@@ -68,7 +68,7 @@ size_t test__pattern()
CPPA_CHECK_EQUAL
(
str
,
"hello foo"
);
CPPA_CHECK_EQUAL
(
str
,
"hello foo"
);
lambda_invoked
[
1
]
=
true
;
lambda_invoked
[
1
]
=
true
;
},
},
on
(
"1"
,
val
<
int
>
()
,
any_vals
)
>>
[
&
](
int
value
)
on
(
"1"
,
val
<
int
>
,
any_vals
)
>>
[
&
](
int
value
)
{
{
CPPA_CHECK_EQUAL
(
value
,
2
);
CPPA_CHECK_EQUAL
(
value
,
2
);
lambda_invoked
[
2
]
=
true
;
lambda_invoked
[
2
]
=
true
;
...
...
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