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
e793c81e
Commit
e793c81e
authored
Jun 25, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix build on MSVC
parent
9f36b670
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
33 deletions
+32
-33
libcaf_core/caf/detail/type_list.hpp
libcaf_core/caf/detail/type_list.hpp
+9
-10
libcaf_core/caf/typed_actor.hpp
libcaf_core/caf/typed_actor.hpp
+19
-19
libcaf_core/test/metaprogramming.cpp
libcaf_core/test/metaprogramming.cpp
+4
-4
No files found.
libcaf_core/caf/detail/type_list.hpp
View file @
e793c81e
...
...
@@ -34,7 +34,11 @@ namespace detail {
/// A list of types.
template
<
class
...
Ts
>
struct
type_list
{
};
struct
type_list
{
constexpr
type_list
()
{
// nop
}
};
/// Denotes the empty list.
using
empty_type_list
=
type_list
<>
;
...
...
@@ -925,8 +929,8 @@ constexpr bool tlf_no_negative() {
return
true
;
}
template
<
class
T
,
class
...
Ts
>
constexpr
bool
tlf_no_negative
(
T
x
,
Ts
...
xs
)
{
template
<
class
...
Ts
>
constexpr
bool
tlf_no_negative
(
int
x
,
Ts
...
xs
)
{
return
x
<
0
?
false
:
tlf_no_negative
(
xs
...);
}
...
...
@@ -935,17 +939,12 @@ constexpr bool tlf_is_subset(type_list<Ts...>, List) {
return
tlf_no_negative
(
tlf_find
<
Ts
>
(
List
{})...);
}
template
<
class
ListA
,
class
ListB
>
constexpr
bool
tlf_is_subset
()
{
return
tlf_is_subset
(
ListA
{},
ListB
{});
}
/// Tests whether ListA contains the same elements as ListB
/// and vice versa. This comparison ignores element positions.
template
<
class
ListA
,
class
ListB
>
struct
tl_equal
{
static
constexpr
bool
value
=
tlf_is_subset
<
ListA
,
ListB
>
(
)
&&
tlf_is_subset
<
ListB
,
ListA
>
(
);
static
constexpr
bool
value
=
tlf_is_subset
(
ListA
{},
ListB
{}
)
&&
tlf_is_subset
(
ListB
{},
ListA
{}
);
};
template
<
size_t
N
,
class
T
>
...
...
libcaf_core/caf/typed_actor.hpp
View file @
e793c81e
...
...
@@ -87,39 +87,39 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
/// Identifies the base class of brokers implementing this interface.
using
broker_base
=
io
::
experimental
::
typed_broker
<
Sigs
...
>
;
/// Stores the template parameter pack.
using
signatures
=
detail
::
type_list
<
Sigs
...
>
;
typed_actor
()
=
default
;
typed_actor
(
typed_actor
&&
)
=
default
;
typed_actor
(
const
typed_actor
&
)
=
default
;
typed_actor
&
operator
=
(
typed_actor
&&
)
=
default
;
typed_actor
&
operator
=
(
const
typed_actor
&
)
=
default
;
template
<
class
...
OtherSigs
,
class
Enable
=
typename
std
::
enable_if
<
detail
::
tlf_is_subset
<
detail
::
type_list
<
Sigs
...>,
detail
::
type_list
<
OtherSigs
...
>>
()
>::
type
>
typed_actor
(
const
typed_actor
<
OtherSigs
...
>&
other
)
:
ptr_
(
other
.
ptr_
)
{
template
<
class
TypedActor
,
class
Enable
=
typename
std
::
enable_if
<
detail
::
tlf_is_subset
(
signatures
{},
typename
TypedActor
::
signatures
{})
>
::
type
>
typed_actor
(
const
TypedActor
&
other
)
:
ptr_
(
other
.
ptr_
)
{
// nop
}
template
<
class
...
OtherSigs
,
class
Enable
=
typename
std
::
enable_if
<
detail
::
tlf_is_subset
<
detail
::
type_list
<
Sigs
...>,
detail
::
type_list
<
OtherSigs
...
>>
()
>::
type
>
typed_actor
&
operator
=
(
const
typed_actor
<
OtherSigs
...
>&
other
)
{
template
<
class
TypedActor
,
class
Enable
=
typename
std
::
enable_if
<
detail
::
tlf_is_subset
(
signatures
{},
typename
TypedActor
::
signatures
{})
>
::
type
>
typed_actor
&
operator
=
(
const
TypedActor
&
other
)
{
ptr_
=
other
.
ptr_
;
return
*
this
;
}
template
<
class
Impl
,
class
Enable
=
typename
std
::
enable_if
<
detail
::
tlf_is_subset
<
detail
::
type_list
<
Sigs
...>,
typename
Impl
::
signatures
>
()
>::
type
>
class
Enable
=
typename
std
::
enable_if
<
detail
::
tlf_is_subset
(
signatures
{},
typename
Impl
::
signatures
{})
>
::
type
>
typed_actor
(
intrusive_ptr
<
Impl
>
other
)
:
ptr_
(
std
::
move
(
other
))
{
// nop
}
...
...
libcaf_core/test/metaprogramming.cpp
View file @
e793c81e
...
...
@@ -90,9 +90,9 @@ CAF_TEST(metaprogramming) {
/* test tlf_is_subset */
{
using
list_a
=
type_list
<
int
,
float
,
double
>
;
using
list_b
=
type_list
<
float
,
int
,
double
,
std
::
string
>
;
CAF_CHECK
((
tlf_is_subset
<
list_a
,
list_b
>
(
)));
CAF_CHECK
(
!
(
tlf_is_subset
<
list_b
,
list_a
>
(
)));
CAF_CHECK
((
tlf_is_subset
<
list_a
,
list_a
>
(
)));
CAF_CHECK
((
tlf_is_subset
<
list_b
,
list_b
>
(
)));
CAF_CHECK
((
tlf_is_subset
(
list_a
{},
list_b
{}
)));
CAF_CHECK
(
!
(
tlf_is_subset
(
list_b
{},
list_a
{}
)));
CAF_CHECK
((
tlf_is_subset
(
list_a
{},
list_a
{}
)));
CAF_CHECK
((
tlf_is_subset
(
list_b
{},
list_b
{}
)));
}
}
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