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
1df98a63
Commit
1df98a63
authored
Mar 03, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify preconditions of zip_ algorithms
parent
57593e7a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
libcaf_core/caf/detail/algorithms.hpp
libcaf_core/caf/detail/algorithms.hpp
+5
-4
No files found.
libcaf_core/caf/detail/algorithms.hpp
View file @
1df98a63
...
@@ -26,16 +26,16 @@
...
@@ -26,16 +26,16 @@
namespace
caf
{
namespace
caf
{
namespace
detail
{
namespace
detail
{
/// Calls `f` for all elements in the given containers. Behavior is undefined
/// Like `std::for_each`, but for multiple containers.
/// for containers of different sizes.
/// @pre `x.size() <= y.size()` for each `y` in `xs`
/// @pre All containers have the same size.
template
<
class
F
,
class
Container
,
class
...
Containers
>
template
<
class
F
,
class
Container
,
class
...
Containers
>
void
zip_foreach
(
F
f
,
Container
&&
x
,
Containers
&&
...
xs
)
{
void
zip_foreach
(
F
f
,
Container
&&
x
,
Containers
&&
...
xs
)
{
for
(
size_t
i
=
0
;
i
<
x
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
x
.
size
();
++
i
)
f
(
x
[
i
],
xs
[
i
]...);
f
(
x
[
i
],
xs
[
i
]...);
}
}
/// Like `std::accumulate`, but for multiple containers of equal size.
/// Like `std::accumulate`, but for multiple containers.
/// @pre `x.size() <= y.size()` for each `y` in `xs`
template
<
class
F
,
class
T
,
class
Container
,
class
...
Containers
>
template
<
class
F
,
class
T
,
class
Container
,
class
...
Containers
>
T
zip_fold
(
F
f
,
T
init
,
Container
&&
x
,
Containers
&&
...
xs
)
{
T
zip_fold
(
F
f
,
T
init
,
Container
&&
x
,
Containers
&&
...
xs
)
{
for
(
size_t
i
=
0
;
i
<
x
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
x
.
size
();
++
i
)
...
@@ -58,6 +58,7 @@ struct container_view {
...
@@ -58,6 +58,7 @@ struct container_view {
};
};
/// Returns a container view for `x`.
/// Returns a container view for `x`.
/// @relates container_view
template
<
class
F
,
class
Container
>
template
<
class
F
,
class
Container
>
container_view
<
F
,
Container
>
make_container_view
(
Container
&
x
)
{
container_view
<
F
,
Container
>
make_container_view
(
Container
&
x
)
{
return
{
x
};
return
{
x
};
...
...
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