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
e41694da
Commit
e41694da
authored
Jan 17, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
maintenance
parent
ebe6640a
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
147 additions
and
449 deletions
+147
-449
Makefile.am
Makefile.am
+0
-5
cppa.files
cppa.files
+0
-6
cppa/detail/type_to_ptype.hpp
cppa/detail/type_to_ptype.hpp
+2
-6
cppa/get_view.hpp
cppa/get_view.hpp
+4
-1
cppa/object.hpp
cppa/object.hpp
+2
-4
cppa/on.hpp
cppa/on.hpp
+0
-2
cppa/pattern.hpp
cppa/pattern.hpp
+2
-2
cppa/util.hpp
cppa/util.hpp
+0
-4
cppa/util/apply.hpp
cppa/util/apply.hpp
+0
-55
cppa/util/compare_tuples.hpp
cppa/util/compare_tuples.hpp
+2
-3
cppa/util/eval_first_n.hpp
cppa/util/eval_first_n.hpp
+0
-62
cppa/util/eval_type_list.hpp
cppa/util/eval_type_list.hpp
+0
-61
cppa/util/eval_type_lists.hpp
cppa/util/eval_type_lists.hpp
+0
-70
cppa/util/filter_type_list.hpp
cppa/util/filter_type_list.hpp
+0
-67
cppa/util/first_n.hpp
cppa/util/first_n.hpp
+0
-83
cppa/util/is_legal_tuple_type.hpp
cppa/util/is_legal_tuple_type.hpp
+3
-3
cppa/util/type_list.hpp
cppa/util/type_list.hpp
+132
-9
unit_testing/main.cpp
unit_testing/main.cpp
+0
-1
unit_testing/test__serialization.cpp
unit_testing/test__serialization.cpp
+0
-1
unit_testing/test__type_list.cpp
unit_testing/test__type_list.cpp
+0
-4
No files found.
Makefile.am
View file @
e41694da
...
...
@@ -171,7 +171,6 @@ nobase_library_include_HEADERS = \
cppa/uniform_type_info.hpp
\
cppa/util/abstract_uniform_type_info.hpp
\
cppa/util/any_tuple_iterator.hpp
\
cppa/util/apply.hpp
\
cppa/util/arg_match_t.hpp
\
cppa/util/at.hpp
\
cppa/util/callable_trait.hpp
\
...
...
@@ -186,11 +185,7 @@ nobase_library_include_HEADERS = \
cppa/util/either.hpp
\
cppa/util/element_at.hpp
\
cppa/util/enable_if.hpp
\
cppa/util/eval_first_n.hpp
\
cppa/util/eval_type_lists.hpp
\
cppa/util/fiber.hpp
\
cppa/util/filter_type_list.hpp
\
cppa/util/first_n.hpp
\
cppa/util/fixed_vector.hpp
\
cppa/util/has_copy_member_fun.hpp
\
cppa/util.hpp
\
...
...
cppa.files
View file @
e41694da
...
...
@@ -24,12 +24,10 @@ src/mock_scheduler.cpp
cppa/actor.hpp
unit_testing/test__intrusive_ptr.cpp
cppa/util/concat_type_lists.hpp
cppa/util/filter_type_list.hpp
cppa/util/is_comparable.hpp
cppa/util/callable_trait.hpp
unit_testing/test__type_list.cpp
cppa/util/remove_const_reference.hpp
cppa/util/eval_type_lists.hpp
cppa/util/compare_tuples.hpp
cppa/get.hpp
cppa/detail/tdata.hpp
...
...
@@ -49,7 +47,6 @@ cppa/detail/object_impl.hpp
cppa/detail/swap_bytes.hpp
src/serializer.cpp
src/deserializer.cpp
cppa/util/eval_type_list.hpp
cppa/util/is_legal_tuple_type.hpp
cppa/util/replace_type.hpp
cppa/detail/serialize_tuple.hpp
...
...
@@ -61,8 +58,6 @@ unit_testing/test__local_group.cpp
unit_testing/hash_of.cpp
unit_testing/hash_of.hpp
cppa/detail/channel.hpp
cppa/util/first_n.hpp
cppa/util/eval_first_n.hpp
cppa/local_actor.hpp
cppa/channel.hpp
src/channel.cpp
...
...
@@ -96,7 +91,6 @@ cppa/detail/default_uniform_type_info_impl.hpp
src/object.cpp
cppa/util/comparable.hpp
cppa/util/disable_if.hpp
cppa/util/apply.hpp
cppa/primitive_variant.hpp
cppa/primitive_type.hpp
cppa/util/pt_token.hpp
...
...
cppa/detail/type_to_ptype.hpp
View file @
e41694da
...
...
@@ -36,8 +36,6 @@
#include "cppa/primitive_type.hpp"
#include "cppa/util/apply.hpp"
namespace
cppa
{
namespace
detail
{
// if (IfStmt == true) ptype = PT; else ptype = Else::ptype;
...
...
@@ -68,8 +66,8 @@ struct type_to_ptype_impl :
if_else_ptype
<
std
::
is_same
<
T
,
std
::
int16_t
>
,
pt_int16
,
if_else_ptype
<
std
::
is_same
<
T
,
std
::
int32_t
>
,
pt_int32
,
if_else_ptype
<
std
::
is_same
<
T
,
std
::
int64_t
>
,
pt_int64
,
if_else_ptype
<
std
::
is_same
<
T
,
std
::
uint8_t
>
,
pt_uint8
,
// unsigned integers
if_else_ptype
<
std
::
is_same
<
T
,
std
::
uint8_t
>
,
pt_uint8
,
if_else_ptype
<
std
::
is_same
<
T
,
std
::
uint16_t
>
,
pt_uint16
,
if_else_ptype
<
std
::
is_same
<
T
,
std
::
uint32_t
>
,
pt_uint32
,
if_else_ptype
<
std
::
is_same
<
T
,
std
::
uint64_t
>
,
pt_uint64
,
...
...
@@ -90,9 +88,7 @@ template<typename T>
struct
type_to_ptype
{
typedef
typename
util
::
apply
<
T
,
std
::
remove_reference
,
std
::
remove_cv
>::
type
type
;
typedef
typename
std
::
remove_cv
<
typename
std
::
remove_reference
<
T
>::
type
>::
type
type
;
static
const
primitive_type
ptype
=
type_to_ptype_impl
<
type
>::
ptype
;
...
...
cppa/get_view.hpp
View file @
e41694da
...
...
@@ -40,10 +40,13 @@
#include "cppa/any_tuple.hpp"
#include "cppa/tuple_view.hpp"
#include "cppa/util/tbind.hpp"
#include "cppa/util/type_list.hpp"
namespace
cppa
{
template
<
typename
...
MatchRules
>
typename
tuple_view_type_from_type_list
<
typename
util
::
filter_type_list
<
anything
,
util
::
type_list
<
MatchRules
...
>
>::
type
>::
type
typename
tuple_view_type_from_type_list
<
typename
util
::
lt_filter_not
<
util
::
type_list
<
MatchRules
...
>
,
util
::
tbind
<
std
::
is_same
,
anything
>::
type
>::
type
>::
type
get_view
(
any_tuple
const
&
ut
)
{
pattern
<
MatchRules
...
>
p
;
...
...
cppa/object.hpp
View file @
e41694da
...
...
@@ -178,8 +178,7 @@ inline bool operator!=(object const& lhs, object const& rhs)
template
<
typename
T
>
T
&
get_ref
(
object
&
obj
)
{
static_assert
(
util
::
disjunction
<
std
::
is_pointer
<
T
>
,
std
::
is_reference
<
T
>>::
value
==
false
,
static_assert
(
!
std
::
is_pointer
<
T
>::
value
&&
!
std
::
is_reference
<
T
>::
value
,
"T is a reference or a pointer type."
);
if
(
!
(
obj
.
type
()
==
typeid
(
T
)))
{
...
...
@@ -191,8 +190,7 @@ T& get_ref(object& obj)
template
<
typename
T
>
T
const
&
get
(
object
const
&
obj
)
{
static_assert
(
util
::
disjunction
<
std
::
is_pointer
<
T
>
,
std
::
is_reference
<
T
>>::
value
==
false
,
static_assert
(
!
std
::
is_pointer
<
T
>::
value
&&
!
std
::
is_reference
<
T
>::
value
,
"T is a reference or a pointer type."
);
if
(
!
(
obj
.
type
()
==
typeid
(
T
)))
{
...
...
cppa/on.hpp
View file @
e41694da
...
...
@@ -45,9 +45,7 @@
#include "cppa/util/type_list.hpp"
#include "cppa/util/enable_if.hpp"
#include "cppa/util/arg_match_t.hpp"
#include "cppa/util/eval_first_n.hpp"
#include "cppa/util/callable_trait.hpp"
#include "cppa/util/filter_type_list.hpp"
#include "cppa/util/concat_type_lists.hpp"
#include "cppa/detail/boxed.hpp"
...
...
cppa/pattern.hpp
View file @
e41694da
...
...
@@ -39,8 +39,8 @@
#include "cppa/any_tuple.hpp"
#include "cppa/uniform_type_info.hpp"
#include "cppa/util/tbind.hpp"
#include "cppa/util/type_list.hpp"
#include "cppa/util/filter_type_list.hpp"
#include "cppa/detail/tdata.hpp"
#include "cppa/detail/types_array.hpp"
...
...
@@ -68,7 +68,7 @@ class pattern<T0, Tn...>
typedef
util
::
type_list
<
T0
,
Tn
...
>
tpl_args
;
typedef
typename
util
::
filter_type_list
<
anything
,
tpl_args
>::
type
typedef
typename
util
::
lt_filter_not
<
tpl_args
,
util
::
tbind
<
std
::
is_same
,
anything
>::
type
>::
type
filtered_tpl_args
;
typedef
typename
tuple_view_type_from_type_list
<
filtered_tpl_args
>::
type
...
...
cppa/util.hpp
View file @
e41694da
...
...
@@ -31,16 +31,12 @@
#ifndef UTIL_HPP
#define UTIL_HPP
#include "cppa/util/apply.hpp"
#include "cppa/util/callable_trait.hpp"
#include "cppa/util/compare_tuples.hpp"
#include "cppa/util/concat_type_lists.hpp"
#include "cppa/util/conjunction.hpp"
#include "cppa/util/disjunction.hpp"
#include "cppa/util/enable_if.hpp"
#include "cppa/util/eval_first_n.hpp"
#include "cppa/util/filter_type_list.hpp"
#include "cppa/util/first_n.hpp"
#include "cppa/util/has_copy_member_fun.hpp"
#include "cppa/util/is_comparable.hpp"
#include "cppa/util/is_copyable.hpp"
...
...
cppa/util/apply.hpp
deleted
100644 → 0
View file @
ebe6640a
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011, 2012 *
* Dominik Charousset <dominik.charousset@haw-hamburg.de> *
* *
* This file is part of libcppa. *
* libcppa is free software: you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License *
* or (at your option) any later version. *
* *
* libcppa is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with libcppa. If not, see <http://www.gnu.org/licenses/>. *
\******************************************************************************/
#ifndef APPLY_HPP
#define APPLY_HPP
namespace
cppa
{
namespace
util
{
template
<
class
C
,
template
<
typename
>
class
...
Traits
>
struct
apply
;
template
<
class
C
>
struct
apply
<
C
>
{
typedef
C
type
;
};
template
<
class
C
,
template
<
typename
>
class
Trait0
,
template
<
typename
>
class
...
Traits
>
struct
apply
<
C
,
Trait0
,
Traits
...
>
{
typedef
typename
apply
<
typename
Trait0
<
C
>::
type
,
Traits
...
>::
type
type
;
};
}
}
#endif // APPLY_HPP
cppa/util/compare_tuples.hpp
View file @
e41694da
...
...
@@ -34,7 +34,6 @@
#include "cppa/get.hpp"
#include "cppa/util/at.hpp"
#include "cppa/util/type_list.hpp"
#include "cppa/util/eval_first_n.hpp"
#include "cppa/util/is_comparable.hpp"
namespace
cppa
{
namespace
detail
{
...
...
@@ -97,8 +96,8 @@ bool compare_first_elements(LhsTuple<LhsTypes...> const& lhs,
typedef
util
::
type_list
<
LhsTypes
...
>
lhs_tlist
;
typedef
util
::
type_list
<
RhsTypes
...
>
rhs_tlist
;
typedef
typename
tl_first_n
<
cmp_size
,
lhs_tlist
>::
type
lhs_sublist
;
typedef
typename
tl_first_n
<
cmp_size
,
rhs_tlist
>::
type
rhs_sublist
;
typedef
typename
tl_first_n
<
lhs_tlist
,
cmp_size
>::
type
lhs_sublist
;
typedef
typename
tl_first_n
<
rhs_tlist
,
cmp_size
>::
type
rhs_sublist
;
typedef
typename
tl_zip
<
lhs_sublist
,
rhs_sublist
>::
type
zipped_sublists
;
static_assert
(
tl_zipped_forall
<
zipped_sublists
,
is_comparable
>::
value
,
...
...
cppa/util/eval_first_n.hpp
deleted
100644 → 0
View file @
ebe6640a
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011, 2012 *
* Dominik Charousset <dominik.charousset@haw-hamburg.de> *
* *
* This file is part of libcppa. *
* libcppa is free software: you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License *
* or (at your option) any later version. *
* *
* libcppa is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with libcppa. If not, see <http://www.gnu.org/licenses/>. *
\******************************************************************************/
#ifndef EVAL_FIRST_N_HPP
#define EVAL_FIRST_N_HPP
#include <type_traits>
#include "cppa/util/first_n.hpp"
#include "cppa/util/type_list.hpp"
#include "cppa/util/eval_type_lists.hpp"
namespace
cppa
{
namespace
util
{
template
<
size_t
N
,
class
ListA
,
class
ListB
,
template
<
typename
,
typename
>
class
What
>
struct
eval_first_n
;
template
<
size_t
N
,
typename
...
TypesA
,
typename
...
TypesB
,
template
<
typename
,
typename
>
class
What
>
struct
eval_first_n
<
N
,
type_list
<
TypesA
...
>
,
type_list
<
TypesB
...
>
,
What
>
{
typedef
type_list
<
TypesA
...
>
first_list
;
typedef
type_list
<
TypesB
...
>
second_list
;
typedef
typename
first_n
<
N
,
first_list
>::
type
slist_a
;
typedef
typename
first_n
<
N
,
second_list
>::
type
slist_b
;
static
constexpr
bool
value
=
eval_type_lists
<
slist_a
,
slist_b
,
What
>::
value
;
};
}
}
// namespace cppa::util
#endif // EVAL_FIRST_N_HPP
cppa/util/eval_type_list.hpp
deleted
100644 → 0
View file @
ebe6640a
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011, 2012 *
* Dominik Charousset <dominik.charousset@haw-hamburg.de> *
* *
* This file is part of libcppa. *
* libcppa is free software: you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License *
* or (at your option) any later version. *
* *
* libcppa is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with libcppa. If not, see <http://www.gnu.org/licenses/>. *
\******************************************************************************/
#ifndef EVAL_TYPE_LIST_HPP
#define EVAL_TYPE_LIST_HPP
#include "cppa/util/type_list.hpp"
#include "cppa/util/concat_type_lists.hpp"
namespace
cppa
{
namespace
util
{
/**
* @brief Apply @p What to each element of @p List.
*/
template
<
class
List
,
template
<
typename
>
class
What
>
struct
eval_type_list
{
typedef
typename
List
::
head
head
;
typedef
typename
List
::
tail
tail
;
static
constexpr
bool
value
=
What
<
head
>::
value
&&
eval_type_list
<
tail
,
What
>::
value
;
};
template
<
template
<
typename
>
class
What
>
struct
eval_type_list
<
type_list
<>
,
What
>
{
static
constexpr
bool
value
=
true
;
};
}
}
// namespace cppa::util
#endif // EVAL_TYPE_LIST_HPP
cppa/util/eval_type_lists.hpp
deleted
100644 → 0
View file @
ebe6640a
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011, 2012 *
* Dominik Charousset <dominik.charousset@haw-hamburg.de> *
* *
* This file is part of libcppa. *
* libcppa is free software: you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License *
* or (at your option) any later version. *
* *
* libcppa is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with libcppa. If not, see <http://www.gnu.org/licenses/>. *
\******************************************************************************/
#ifndef EVAL_TYPE_LISTS_HPP
#define EVAL_TYPE_LISTS_HPP
#include <type_traits>
#include "cppa/util/type_list.hpp"
namespace
cppa
{
namespace
util
{
/**
* @brief Apply @p What to each element of @p List.
*/
template
<
class
ListA
,
class
ListB
,
template
<
typename
,
typename
>
class
What
>
struct
eval_type_lists
{
typedef
typename
ListA
::
head
head_a
;
typedef
typename
ListA
::
tail
tail_a
;
typedef
typename
ListB
::
head
head_b
;
typedef
typename
ListB
::
tail
tail_b
;
static
constexpr
bool
value
=
!
std
::
is_same
<
head_a
,
void_type
>::
value
&&
!
std
::
is_same
<
head_b
,
void_type
>::
value
&&
What
<
head_a
,
head_b
>::
value
&&
eval_type_lists
<
tail_a
,
tail_b
,
What
>::
value
;
};
template
<
template
<
typename
,
typename
>
class
What
>
struct
eval_type_lists
<
type_list
<>
,
type_list
<>
,
What
>
{
static
constexpr
bool
value
=
true
;
};
}
}
// namespace cppa::util
#endif // EVAL_TYPE_LISTS_HPP
cppa/util/filter_type_list.hpp
deleted
100644 → 0
View file @
ebe6640a
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011, 2012 *
* Dominik Charousset <dominik.charousset@haw-hamburg.de> *
* *
* This file is part of libcppa. *
* libcppa is free software: you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License *
* or (at your option) any later version. *
* *
* libcppa is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with libcppa. If not, see <http://www.gnu.org/licenses/>. *
\******************************************************************************/
#ifndef FILTER_TYPE_LIST_HPP
#define FILTER_TYPE_LIST_HPP
#include "cppa/util/type_list.hpp"
namespace
cppa
{
namespace
util
{
template
<
typename
Needle
,
typename
Haystack
>
struct
filter_type_list
;
template
<
typename
Needle
,
typename
...
Tail
>
struct
filter_type_list
<
Needle
,
util
::
type_list
<
Needle
,
Tail
...
>>
{
typedef
typename
filter_type_list
<
Needle
,
util
::
type_list
<
Tail
...
>>::
type
type
;
};
template
<
typename
Needle
,
typename
...
Tail
>
struct
filter_type_list
<
Needle
,
util
::
type_list
<
Needle
*
,
Tail
...
>>
{
typedef
typename
filter_type_list
<
Needle
,
util
::
type_list
<
Tail
...
>>::
type
type
;
};
template
<
typename
Needle
,
typename
Head
,
typename
...
Tail
>
struct
filter_type_list
<
Needle
,
util
::
type_list
<
Head
,
Tail
...
>>
{
typedef
typename
concat_type_lists
<
util
::
type_list
<
Head
>
,
typename
filter_type_list
<
Needle
,
util
::
type_list
<
Tail
...
>>::
type
>::
type
type
;
};
template
<
typename
Needle
>
struct
filter_type_list
<
Needle
,
util
::
type_list
<>>
{
typedef
util
::
type_list
<>
type
;
};
}
}
// namespace cppa::util
#endif // FILTER_TYPE_LIST_HPP
cppa/util/first_n.hpp
deleted
100644 → 0
View file @
ebe6640a
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011, 2012 *
* Dominik Charousset <dominik.charousset@haw-hamburg.de> *
* *
* This file is part of libcppa. *
* libcppa is free software: you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License *
* or (at your option) any later version. *
* *
* libcppa is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with libcppa. If not, see <http://www.gnu.org/licenses/>. *
\******************************************************************************/
#ifndef FIRST_N_HPP
#define FIRST_N_HPP
#include <cstddef>
#include <type_traits>
#include "cppa/util/at.hpp"
#include "cppa/util/wrapped.hpp"
#include "cppa/util/if_else.hpp"
#include "cppa/util/type_list.hpp"
#include "cppa/util/element_at.hpp"
#include "cppa/util/concat_type_lists.hpp"
namespace
cppa
{
namespace
detail
{
template
<
size_t
N
,
typename
List
>
struct
n_
{
typedef
typename
util
::
element_at
<
N
-
1
,
List
>::
type
head
;
typedef
typename
util
::
if_else
<
std
::
is_same
<
util
::
void_type
,
head
>
,
util
::
type_list
<>
,
util
::
wrapped
<
util
::
type_list
<
head
>>>::
type
head_list
;
typedef
typename
n_
<
N
-
1
,
List
>::
type
tail_list
;
typedef
typename
util
::
concat_type_lists
<
tail_list
,
head_list
>::
type
type
;
};
template
<
typename
List
>
struct
n_
<
0
,
List
>
{
typedef
util
::
type_list
<>
type
;
};
}
}
// namespace cppa::detail
namespace
cppa
{
namespace
util
{
template
<
size_t
N
,
typename
List
>
struct
first_n
;
template
<
size_t
N
,
typename
...
ListTypes
>
struct
first_n
<
N
,
util
::
type_list
<
ListTypes
...
>>
{
typedef
typename
detail
::
n_
<
N
,
util
::
type_list
<
ListTypes
...
>>::
type
type
;
};
}
}
// namespace cppa::util
#endif // FIRST_N_HPP
cppa/util/is_legal_tuple_type.hpp
View file @
e41694da
...
...
@@ -38,9 +38,9 @@ namespace cppa { namespace util {
template
<
typename
T
>
struct
is_legal_tuple_type
{
static
constexpr
bool
value
=
std
::
is_
pointer
<
T
>::
value
==
false
&&
std
::
is_reference
<
T
>::
value
==
false
&&
std
::
is_array
<
T
>::
value
==
false
;
static
constexpr
bool
value
=
std
::
is_
reference
<
T
>::
value
==
false
&&
std
::
is_pointer
<
T
>::
value
==
false
&&
std
::
is_array
<
T
>::
value
==
false
;
};
}
}
// namespace cppa::util
...
...
cppa/util/type_list.hpp
View file @
e41694da
...
...
@@ -75,6 +75,8 @@ struct type_list<Head, Tail...>
};
// static list list::zip(list, list)
/**
* @brief Zips two lists of equal size.
*
...
...
@@ -94,6 +96,8 @@ struct tl_zip<type_list<LhsElements...>, type_list<RhsElements...> >
typedef
type_list
<
type_pair
<
LhsElements
,
RhsElements
>
...
>
type
;
};
// list list::reverse()
template
<
class
From
,
typename
...
Elements
>
struct
tl_reverse_impl
;
...
...
@@ -118,6 +122,8 @@ struct tl_reverse
typedef
typename
tl_reverse_impl
<
List
>::
type
type
;
};
// bool list::find(type)
/**
* @brief Finds the first element of type @p What beginning at
* index @p Pos.
...
...
@@ -139,6 +145,8 @@ struct tl_find<type_list<Head, Tail...>, What, Pos>
:
tl_find
<
type_list
<
Tail
...
>
,
What
,
Pos
+
1
>::
value
;
};
// list list::first_n(size_t)
template
<
size_t
N
,
class
List
,
typename
...
T
>
struct
tl_first_n_impl
;
...
...
@@ -157,7 +165,7 @@ struct tl_first_n_impl<N, type_list<L0, L...>, T...>
/**
* @brief Creates a new list from the first @p N elements of @p List.
*/
template
<
size_t
N
,
class
List
>
template
<
class
List
,
size_t
N
>
struct
tl_first_n
{
static_assert
(
N
>
0
,
"N == 0"
);
...
...
@@ -165,6 +173,8 @@ struct tl_first_n
typedef
typename
tl_first_n_impl
<
N
,
List
>::
type
type
;
};
// bool list::forall(predicate)
/**
* @brief Tests whether a predicate holds for all elements of a list.
*/
...
...
@@ -182,6 +192,8 @@ struct tl_forall<type_list<>, Predicate>
static
constexpr
bool
value
=
true
;
};
// bool list::zipped_forall(predicate)
/**
* @brief Tests whether a predicate holds for all elements of a zipped list.
*/
...
...
@@ -200,6 +212,8 @@ struct tl_zipped_forall<type_list<>, Predicate>
static
constexpr
bool
value
=
true
;
};
// static list list::concat(list, list)
/**
* @brief Concatenates two lists.
*/
...
...
@@ -212,31 +226,47 @@ struct tl_concat<type_list<ListATypes...>, type_list<ListBTypes...> >
typedef
type_list
<
ListATypes
...,
ListBTypes
...
>
type
;
};
template
<
class
List
,
typename
Element
>
struct
tl_prepend
;
template
<
typename
E0
,
typename
...
E
>
struct
tl_prepend
<
type_list
<
E
...
>
,
E0
>
{
typedef
type_list
<
E0
,
E
...
>
type
;
};
// list list::appy(trait)
/**
* @brief Applies a "template function" to each element in the list.
*/
template
<
typename
List
,
template
<
typename
>
class
Wha
t
>
template
<
typename
List
,
template
<
typename
>
class
Trai
t
>
struct
tl_apply
;
template
<
template
<
typename
>
class
Wha
t
,
typename
...
Elements
>
struct
tl_apply
<
type_list
<
Elements
...
>
,
Wha
t
>
template
<
template
<
typename
>
class
Trai
t
,
typename
...
Elements
>
struct
tl_apply
<
type_list
<
Elements
...
>
,
Trai
t
>
{
typedef
type_list
<
typename
Wha
t
<
Elements
>::
type
...
>
type
;
typedef
type_list
<
typename
Trai
t
<
Elements
>::
type
...
>
type
;
};
// list list::zipped_apply(trait)
/**
* @brief Applies a binary "template function" to each element
* in the zipped list.
*/
template
<
typename
List
,
template
<
typename
,
typename
>
class
Wha
t
>
template
<
typename
List
,
template
<
typename
,
typename
>
class
Trai
t
>
struct
tl_zipped_apply
;
template
<
template
<
typename
,
typename
>
class
Wha
t
,
typename
...
T
>
struct
tl_zipped_apply
<
type_list
<
T
...
>
,
Wha
t
>
template
<
template
<
typename
,
typename
>
class
Trai
t
,
typename
...
T
>
struct
tl_zipped_apply
<
type_list
<
T
...
>
,
Trai
t
>
{
typedef
type_list
<
typename
What
<
typename
T
::
first
,
typename
T
::
second
>::
type
...
>
type
;
typedef
type_list
<
typename
Trait
<
typename
T
::
first
,
typename
T
::
second
>::
type
...
>
type
;
};
// list list::pop_back()
/**
* @brief Creates a new list wih all but the last element of @p List.
*/
...
...
@@ -247,6 +277,99 @@ struct tl_pop_back
typedef
typename
tl_reverse
<
typename
rlist
::
tail
>::
type
type
;
};
// type list::at(size_t)
template
<
size_t
N
,
typename
...
E
>
struct
lt_at_impl
;
template
<
size_t
N
,
typename
E0
,
typename
...
E
>
struct
lt_at_impl
<
N
,
E0
,
E
...
>
{
typedef
typename
lt_at_impl
<
N
-
1
,
E
...
>::
type
type
;
};
template
<
typename
E0
,
typename
...
E
>
struct
lt_at_impl
<
0
,
E0
,
E
...
>
{
typedef
E0
type
;
};
/**
* @brief Gets element at index @p N of @p List.
*/
template
<
class
List
,
size_t
N
>
struct
lt_at
;
template
<
size_t
N
,
typename
...
E
>
struct
lt_at
<
type_list
<
E
...
>
,
N
>
{
static_assert
(
N
<
sizeof
...(
E
),
"N >= List::size"
);
typedef
typename
lt_at_impl
<
N
,
E
...
>::
type
type
;
};
// list list::prepend(type)
/**
* @brief Creates a new list with @p What prepended to @p List.
*/
template
<
class
List
,
typename
What
>
struct
lt_prepend
;
template
<
typename
What
,
typename
...
T
>
struct
lt_prepend
<
type_list
<
T
...
>
,
What
>
{
typedef
type_list
<
What
,
T
...
>
type
;
};
// list list::filter(predicate)
template
<
class
List
,
bool
...
Selected
>
struct
lt_filter_impl
;
template
<
>
struct
lt_filter_impl
<
type_list
<>
>
{
typedef
type_list
<>
type
;
};
template
<
typename
T0
,
typename
...
T
,
bool
...
S
>
struct
lt_filter_impl
<
type_list
<
T0
,
T
...
>
,
false
,
S
...
>
{
typedef
typename
lt_filter_impl
<
type_list
<
T
...
>
,
S
...
>::
type
type
;
};
template
<
typename
T0
,
typename
...
T
,
bool
...
S
>
struct
lt_filter_impl
<
type_list
<
T0
,
T
...
>
,
true
,
S
...
>
{
typedef
typename
lt_prepend
<
typename
lt_filter_impl
<
type_list
<
T
...
>
,
S
...
>::
type
,
T0
>::
type
type
;
};
/**
* @brief Create a new list containing all elements which satisfy @p Predicate.
*/
template
<
class
List
,
template
<
typename
>
class
Predicate
>
struct
lt_filter
;
template
<
template
<
typename
>
class
Predicate
,
typename
...
T
>
struct
lt_filter
<
type_list
<
T
...
>
,
Predicate
>
{
typedef
typename
lt_filter_impl
<
type_list
<
T
...
>
,
Predicate
<
T
>::
value
...
>::
type
type
;
};
/**
* @brief Create a new list containing all elements which
* do not satisfy @p Predicate.
*/
template
<
class
List
,
template
<
typename
>
class
Predicate
>
struct
lt_filter_not
;
template
<
template
<
typename
>
class
Predicate
,
typename
...
T
>
struct
lt_filter_not
<
type_list
<
T
...
>
,
Predicate
>
{
typedef
typename
lt_filter_impl
<
type_list
<
T
...
>
,
!
Predicate
<
T
>::
value
...
>::
type
type
;
};
}
}
// namespace cppa::util
...
...
unit_testing/main.cpp
View file @
e41694da
...
...
@@ -26,7 +26,6 @@
#include "cppa/detail/thread_pool_scheduler.hpp"
// header for experimental stuff
#include "cppa/util/filter_type_list.hpp"
#include "cppa/util/any_tuple_iterator.hpp"
#define CPPA_TEST_CATCH_BLOCK() \
...
...
unit_testing/test__serialization.cpp
View file @
e41694da
...
...
@@ -40,7 +40,6 @@
#include "cppa/binary_serializer.hpp"
#include "cppa/binary_deserializer.hpp"
#include "cppa/util/apply.hpp"
#include "cppa/util/pt_token.hpp"
#include "cppa/util/enable_if.hpp"
#include "cppa/util/disable_if.hpp"
...
...
unit_testing/test__type_list.cpp
View file @
e41694da
...
...
@@ -21,10 +21,6 @@ size_t test__type_list()
CPPA_TEST
(
test__type_list
);
typedef
apply
<
const
int
&
,
remove_const_reference
>::
type
int_typedef
;
CPPA_CHECK
((
is_same
<
int
,
int_typedef
>::
value
));
typedef
type_list
<
int
,
float
,
std
::
string
>
l1
;
typedef
typename
tl_reverse
<
l1
>::
type
r1
;
...
...
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