Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Core Modules
dune-common
Merge requests
!795
Make Dune::Hybrid::accumulate to be usable in constexpr context
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Make Dune::Hybrid::accumulate to be usable in constexpr context
feature/hybrid-more-constexpr
into
master
Overview
1
Commits
2
Pipelines
3
Changes
2
Merged
Timo Koch
requested to merge
feature/hybrid-more-constexpr
into
master
5 years ago
Overview
1
Commits
2
Pipelines
3
Changes
2
Expand
Make
Dune::Hybrid::accumulate
to be usable in
constexpr
context.
Edited
5 years ago
by
Timo Koch
0
0
Merge request reports
Compare
master
version 3
945dddcd
5 years ago
version 2
40b9437b
5 years ago
version 1
40b9437b
5 years ago
master (base)
and
latest version
latest version
2a3eb2a4
2 commits,
5 years ago
version 3
945dddcd
1 commit,
5 years ago
version 2
40b9437b
1 commit,
5 years ago
version 1
40b9437b
2 commits,
5 years ago
2 files
+
8
−
3
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
dune/common/test/hybridutilitiestest.cc
+
7
−
2
Options
@@ -48,7 +48,7 @@ auto incAndAppendToFirst(C&& c)
}
template
<
class
C
>
auto
sum
(
C
&&
c
)
constexpr
auto
sum
(
C
&&
c
)
{
using
namespace
Dune
::
Hybrid
;
using
namespace
Dune
::
Indices
;
@@ -99,12 +99,17 @@ int main()
test
.
check
(
mixedTuple
==
Dune
::
makeTupleVector
(
std
::
string
(
"1+1"
),
3
,
4
))
<<
"Adding indices to vector entries with Hybrid::forEach failed."
;
auto
values
=
std
::
make_integer_sequence
<
std
::
size_t
,
30
>
();
constexpr
auto
values
=
std
::
make_integer_sequence
<
std
::
size_t
,
30
>
();
test
.
check
((
30
*
29
)
/
2
==
sum
(
values
))
<<
"accumulate() yields incorrect result."
;
test
.
check
((
29
*
28
)
/
2
==
sumSubsequence
(
values
,
std
::
make_integer_sequence
<
std
::
size_t
,
29
>
()))
<<
"Summing up subsequence failed."
;
// Compile time checks
static_assert
(
sum
(
values
)
==
(
30
*
29
)
/
2
,
"Wrong compile time sum!"
);
constexpr
auto
numberTupleConstexpr
=
Dune
::
makeTupleVector
(
0.1
,
2
,
3
);
static_assert
(
sum
(
numberTupleConstexpr
)
==
5.1
,
"Wrong compile time sum!"
);
return
test
.
exit
();
}
Loading