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
cf13709e
Commit
cf13709e
authored
Apr 16, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring (gbind -> gcall)
parent
332f9eee
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
26 deletions
+27
-26
cppa/guard_expr.hpp
cppa/guard_expr.hpp
+24
-23
cppa/on.hpp
cppa/on.hpp
+1
-1
unit_testing/test__match.cpp
unit_testing/test__match.cpp
+2
-2
No files found.
cppa/guard_expr.hpp
View file @
cf13709e
...
...
@@ -116,19 +116,19 @@ struct guard_expr
// bind utility for placeholders
template
<
typename
Fun
,
typename
T1
>
struct
g
bind
1
struct
g
call
1
{
typedef
guard_expr
<
exec_fun1_op
,
Fun
,
T1
>
result
;
};
template
<
typename
Fun
,
typename
T1
,
typename
T2
>
struct
g
bind
2
struct
g
call
2
{
typedef
guard_expr
<
exec_fun2_op
,
guard_expr
<
dummy_op
,
Fun
,
T1
>
,
T2
>
result
;
};
template
<
typename
Fun
,
typename
T1
,
typename
T2
,
typename
T3
>
struct
g
bind
3
struct
g
call
3
{
typedef
guard_expr
<
exec_fun3_op
,
guard_expr
<
dummy_op
,
Fun
,
T1
>
,
guard_expr
<
dummy_op
,
T2
,
T3
>
>
...
...
@@ -139,7 +139,7 @@ struct gbind3
* @brief Call wrapper for guard placeholders and lazy evaluation.
*/
template
<
typename
Fun
,
typename
T1
>
typename
g
bind1
<
Fun
,
T1
>::
result
gbind
(
Fun
fun
,
T1
t1
)
typename
g
call1
<
Fun
,
T1
>::
result
gcall
(
Fun
fun
,
T1
t1
)
{
return
{
fun
,
t1
};
}
...
...
@@ -148,7 +148,7 @@ typename gbind1<Fun, T1>::result gbind(Fun fun, T1 t1)
* @brief Call wrapper for guard placeholders and lazy evaluation.
*/
template
<
typename
Fun
,
typename
T1
,
typename
T2
>
typename
g
bind2
<
Fun
,
T1
,
T2
>::
result
gbind
(
Fun
fun
,
T1
t1
,
T2
t2
)
typename
g
call2
<
Fun
,
T1
,
T2
>::
result
gcall
(
Fun
fun
,
T1
t1
,
T2
t2
)
{
return
{
fun
,
t1
,
t2
};
}
...
...
@@ -157,16 +157,17 @@ typename gbind2<Fun, T1, T2>::result gbind(Fun fun, T1 t1, T2 t2)
* @brief Call wrapper for guard placeholders and lazy evaluation.
*/
template
<
typename
Fun
,
typename
T1
,
typename
T2
,
typename
T3
>
typename
g
bind3
<
Fun
,
T1
,
T2
,
T3
>::
result
gbind
(
Fun
fun
,
T1
t1
,
T2
t2
,
T3
t3
)
typename
g
call3
<
Fun
,
T1
,
T2
,
T3
>::
result
gcall
(
Fun
fun
,
T1
t1
,
T2
t2
,
T3
t3
)
{
return
{
fun
,
t1
,
t2
,
t3
};
}
/**
* @brief Call wrapper for any given functor returning a boolean.
* @brief Calls @p fun with all arguments given to the guard expression.
* The functor @p fun must return a boolean.
*/
template
<
typename
Fun
>
guard_expr
<
exec_xfun_op
,
Fun
,
util
::
void_type
>
g
call
(
Fun
fun
)
guard_expr
<
exec_xfun_op
,
Fun
,
util
::
void_type
>
g
e_sub_function
(
Fun
fun
)
{
return
{
fun
,
util
::
void_type
{}};
}
...
...
@@ -205,12 +206,12 @@ struct guard_placeholder
constexpr
guard_placeholder
()
{
}
/**
* @brief Convenient way to call <tt>g
bind
(fun, guard_placeholder)</tt>.
* @brief Convenient way to call <tt>g
call
(fun, guard_placeholder)</tt>.
*/
template
<
typename
Fun
>
typename
g
bind
1
<
Fun
,
guard_placeholder
>::
result
operator
()(
Fun
fun
)
const
typename
g
call
1
<
Fun
,
guard_placeholder
>::
result
operator
()(
Fun
fun
)
const
{
return
g
bind
(
fun
,
*
this
);
return
g
call
(
fun
,
*
this
);
}
// utility function for starts_with()
...
...
@@ -222,13 +223,13 @@ struct guard_placeholder
/**
* @brief Evaluates to true if unbound argument starts with @p str.
*/
typename
g
bind
2
<
decltype
(
&
guard_placeholder
::
u8_starts_with
),
typename
g
call
2
<
decltype
(
&
guard_placeholder
::
u8_starts_with
),
guard_placeholder
,
std
::
string
>::
result
starts_with
(
std
::
string
str
)
const
{
return
g
bind
(
&
guard_placeholder
::
u8_starts_with
,
*
this
,
str
);
return
g
call
(
&
guard_placeholder
::
u8_starts_with
,
*
this
,
str
);
}
/**
...
...
@@ -236,10 +237,10 @@ struct guard_placeholder
* is contained in @p container.
*/
template
<
class
C
>
typename
g
bind
2
<
ge_search_container
,
C
,
guard_placeholder
>::
result
typename
g
call
2
<
ge_search_container
,
C
,
guard_placeholder
>::
result
in
(
C
container
)
const
{
return
g
bind
(
ge_search_container
{
true
},
container
,
*
this
);
return
g
call
(
ge_search_container
{
true
},
container
,
*
this
);
}
/**
...
...
@@ -247,13 +248,13 @@ struct guard_placeholder
* is contained in @p container.
*/
template
<
class
C
>
typename
g
bind
2
<
ge_search_container
,
typename
g
call
2
<
ge_search_container
,
std
::
reference_wrapper
<
C
>
,
guard_placeholder
>::
result
in
(
std
::
reference_wrapper
<
C
>
container
)
const
{
return
g
bind
(
ge_search_container
{
true
},
container
,
*
this
);
return
g
call
(
ge_search_container
{
true
},
container
,
*
this
);
}
/**
...
...
@@ -261,7 +262,7 @@ struct guard_placeholder
* is contained in @p list.
*/
template
<
typename
T
>
typename
g
bind
2
<
ge_search_container
,
typename
g
call
2
<
ge_search_container
,
std
::
vector
<
typename
detail
::
strip_and_convert
<
T
>::
type
>
,
guard_placeholder
>::
result
...
...
@@ -277,10 +278,10 @@ struct guard_placeholder
* is not contained in @p container.
*/
template
<
class
C
>
typename
g
bind
2
<
ge_search_container
,
C
,
guard_placeholder
>::
result
typename
g
call
2
<
ge_search_container
,
C
,
guard_placeholder
>::
result
not_in
(
C
container
)
const
{
return
g
bind
(
ge_search_container
{
false
},
container
,
*
this
);
return
g
call
(
ge_search_container
{
false
},
container
,
*
this
);
}
/**
...
...
@@ -288,13 +289,13 @@ struct guard_placeholder
* is not contained in @p container.
*/
template
<
class
C
>
typename
g
bind
2
<
ge_search_container
,
typename
g
call
2
<
ge_search_container
,
std
::
reference_wrapper
<
C
>
,
guard_placeholder
>::
result
not_in
(
std
::
reference_wrapper
<
C
>
container
)
const
{
return
g
bind
(
ge_search_container
{
false
},
container
,
*
this
);
return
g
call
(
ge_search_container
{
false
},
container
,
*
this
);
}
/**
...
...
@@ -302,7 +303,7 @@ struct guard_placeholder
* is not contained in @p list.
*/
template
<
typename
T
>
typename
g
bind
2
<
ge_search_container
,
typename
g
call
2
<
ge_search_container
,
std
::
vector
<
typename
detail
::
strip_and_convert
<
T
>::
type
>
,
guard_placeholder
>::
result
...
...
cppa/on.hpp
View file @
cf13709e
...
...
@@ -160,7 +160,7 @@ struct rvalue_builder
&&
!
std
::
is_same
<
Guard
,
value_guard
<
util
::
type_list
<>
>>::
value
>::
type
*
=
0
)
const
{
return
{(
g
call
(
m_guard
)
&&
ng
),
std
::
move
(
m_funs
)};
return
{(
g
e_sub_function
(
m_guard
)
&&
ng
),
std
::
move
(
m_funs
)};
}
template
<
typename
NewGuard
>
...
...
unit_testing/test__match.cpp
View file @
cf13709e
...
...
@@ -34,12 +34,12 @@ size_t test__match()
using
namespace
std
::
placeholders
;
using
namespace
cppa
::
placeholders
;
auto
expr0
=
g
bind
(
ascending
,
_x1
,
_x2
,
_x3
);
auto
expr0
=
g
call
(
ascending
,
_x1
,
_x2
,
_x3
);
CPPA_CHECK
(
ge_invoke
(
expr0
,
1
,
2
,
3
));
CPPA_CHECK
(
!
ge_invoke
(
expr0
,
3
,
2
,
1
));
int
ival0
=
2
;
auto
expr01
=
g
bind
(
ascending
,
_x1
,
std
::
ref
(
ival0
),
_x2
);
auto
expr01
=
g
call
(
ascending
,
_x1
,
std
::
ref
(
ival0
),
_x2
);
CPPA_CHECK
(
ge_invoke
(
expr01
,
1
,
3
));
++
ival0
;
CPPA_CHECK
(
!
ge_invoke
(
expr01
,
1
,
3
));
...
...
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