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
d95f40d6
Commit
d95f40d6
authored
May 19, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add constexpr constructors where possible
parent
8f328ae5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
30 additions
and
14 deletions
+30
-14
libcaf_core/caf/anything.hpp
libcaf_core/caf/anything.hpp
+3
-1
libcaf_core/caf/detail/boxed.hpp
libcaf_core/caf/detail/boxed.hpp
+9
-8
libcaf_core/caf/detail/wrapped.hpp
libcaf_core/caf/detail/wrapped.hpp
+6
-0
libcaf_core/caf/none.hpp
libcaf_core/caf/none.hpp
+8
-1
libcaf_core/caf/on.hpp
libcaf_core/caf/on.hpp
+1
-1
libcaf_core/caf/policy/work_stealing.hpp
libcaf_core/caf/policy/work_stealing.hpp
+1
-1
libcaf_core/src/uniform_type_info_map.cpp
libcaf_core/src/uniform_type_info_map.cpp
+2
-2
No files found.
libcaf_core/caf/anything.hpp
View file @
d95f40d6
...
@@ -28,7 +28,9 @@ namespace caf {
...
@@ -28,7 +28,9 @@ namespace caf {
* Acts as wildcard expression in patterns.
* Acts as wildcard expression in patterns.
*/
*/
struct
anything
{
struct
anything
{
// no content
constexpr
anything
()
{
// nop
}
};
};
/**
/**
...
...
libcaf_core/caf/detail/boxed.hpp
View file @
d95f40d6
...
@@ -28,50 +28,51 @@ namespace detail {
...
@@ -28,50 +28,51 @@ namespace detail {
template
<
class
T
>
template
<
class
T
>
struct
boxed
{
struct
boxed
{
constexpr
boxed
()
{
// nop
}
using
type
=
detail
::
wrapped
<
T
>
;
using
type
=
detail
::
wrapped
<
T
>
;
};
};
template
<
class
T
>
template
<
class
T
>
struct
boxed
<
detail
::
wrapped
<
T
>>
{
struct
boxed
<
detail
::
wrapped
<
T
>>
{
constexpr
boxed
()
{
// nop
}
using
type
=
detail
::
wrapped
<
T
>
;
using
type
=
detail
::
wrapped
<
T
>
;
};
};
template
<
>
template
<
>
struct
boxed
<
anything
>
{
struct
boxed
<
anything
>
{
constexpr
boxed
()
{
// nop
}
using
type
=
anything
;
using
type
=
anything
;
};
};
template
<
class
T
>
template
<
class
T
>
struct
is_boxed
{
struct
is_boxed
{
static
constexpr
bool
value
=
false
;
static
constexpr
bool
value
=
false
;
};
};
template
<
class
T
>
template
<
class
T
>
struct
is_boxed
<
detail
::
wrapped
<
T
>>
{
struct
is_boxed
<
detail
::
wrapped
<
T
>>
{
static
constexpr
bool
value
=
true
;
static
constexpr
bool
value
=
true
;
};
};
template
<
class
T
>
template
<
class
T
>
struct
is_boxed
<
detail
::
wrapped
<
T
>
()
>
{
struct
is_boxed
<
detail
::
wrapped
<
T
>
()
>
{
static
constexpr
bool
value
=
true
;
static
constexpr
bool
value
=
true
;
};
};
template
<
class
T
>
template
<
class
T
>
struct
is_boxed
<
detail
::
wrapped
<
T
>
(
&
)()
>
{
struct
is_boxed
<
detail
::
wrapped
<
T
>
(
&
)()
>
{
static
constexpr
bool
value
=
true
;
static
constexpr
bool
value
=
true
;
};
};
template
<
class
T
>
template
<
class
T
>
struct
is_boxed
<
detail
::
wrapped
<
T
>
(
*
)()
>
{
struct
is_boxed
<
detail
::
wrapped
<
T
>
(
*
)()
>
{
static
constexpr
bool
value
=
true
;
static
constexpr
bool
value
=
true
;
};
};
}
// namespace detail
}
// namespace detail
...
...
libcaf_core/caf/detail/wrapped.hpp
View file @
d95f40d6
...
@@ -25,11 +25,17 @@ namespace detail {
...
@@ -25,11 +25,17 @@ namespace detail {
template
<
class
T
>
template
<
class
T
>
struct
wrapped
{
struct
wrapped
{
constexpr
wrapped
()
{
// nop
}
using
type
=
T
;
using
type
=
T
;
};
};
template
<
class
T
>
template
<
class
T
>
struct
wrapped
<
wrapped
<
T
>>
{
struct
wrapped
<
wrapped
<
T
>>
{
constexpr
wrapped
()
{
// nop
}
using
type
=
typename
wrapped
<
T
>::
type
;
using
type
=
typename
wrapped
<
T
>::
type
;
};
};
...
...
libcaf_core/caf/none.hpp
View file @
d95f40d6
...
@@ -22,7 +22,14 @@
...
@@ -22,7 +22,14 @@
namespace
caf
{
namespace
caf
{
struct
none_t
{
inline
explicit
operator
bool
()
const
{
return
false
;
}
};
struct
none_t
{
constexpr
none_t
()
{
// nop
}
constexpr
explicit
operator
bool
()
const
{
return
false
;
}
};
static
constexpr
none_t
none
=
none_t
{};
static
constexpr
none_t
none
=
none_t
{};
...
...
libcaf_core/caf/on.hpp
View file @
d95f40d6
...
@@ -92,7 +92,7 @@ constexpr typename detail::boxed<T>::type val() {
...
@@ -92,7 +92,7 @@ constexpr typename detail::boxed<T>::type val() {
* of a given callback, must be the last argument to `on()`.
* of a given callback, must be the last argument to `on()`.
*/
*/
constexpr
auto
arg_match
=
typename
detail
::
boxed
<
detail
::
arg_match_t
>::
type
();
constexpr
auto
arg_match
=
detail
::
boxed
<
detail
::
arg_match_t
>::
type
();
/**
/**
* Generates function objects from a binary predicate and a value.
* Generates function objects from a binary predicate and a value.
...
...
libcaf_core/caf/policy/work_stealing.hpp
View file @
d95f40d6
...
@@ -141,7 +141,7 @@ class work_stealing {
...
@@ -141,7 +141,7 @@ class work_stealing {
size_t
steal_interval
;
size_t
steal_interval
;
std
::
chrono
::
microseconds
sleep_duration
;
std
::
chrono
::
microseconds
sleep_duration
;
};
};
constexpr
poll_strategy
strategies
[
3
]
=
{
poll_strategy
strategies
[
3
]
=
{
// aggressive polling (100x) without sleep interval
// aggressive polling (100x) without sleep interval
{
100
,
1
,
10
,
std
::
chrono
::
microseconds
{
0
}},
{
100
,
1
,
10
,
std
::
chrono
::
microseconds
{
0
}},
// moderate polling (500x) with 50 us sleep interval
// moderate polling (500x) with 50 us sleep interval
...
...
libcaf_core/src/uniform_type_info_map.cpp
View file @
d95f40d6
...
@@ -671,8 +671,8 @@ class utim_impl : public uniform_type_info_map {
...
@@ -671,8 +671,8 @@ class utim_impl : public uniform_type_info_map {
using
strvec
=
std
::
vector
<
std
::
string
>
;
using
strvec
=
std
::
vector
<
std
::
string
>
;
using
builtin_types
=
using
builtin_types
=
t
ypename
t
l_apply
<
tl_apply
<
t
ypename
t
l_map
<
tl_map
<
sorted_builtin_types
,
sorted_builtin_types
,
get_uti_impl
get_uti_impl
>::
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