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
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Timo Koch
dune-common
Commits
aa2e281e
Commit
aa2e281e
authored
17 years ago
by
Markus Blatt
Browse files
Options
Downloads
Patches
Plain Diff
Added size method.
[[Imported from SVN: r4952]]
parent
f5cdbd5d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/test/tuplestest.cc
+2
-0
2 additions, 0 deletions
common/test/tuplestest.cc
common/tuples.hh
+27
-0
27 additions, 0 deletions
common/tuples.hh
with
29 additions
and
0 deletions
common/test/tuplestest.cc
+
2
−
0
View file @
aa2e281e
...
...
@@ -39,6 +39,8 @@ int iteratorTupleTest()
Tuple
tuple
(
v
.
begin
(),
v
.
begin
(),
v
.
end
());
assert
(
Size
<
Tuple
>::
value
==
3
);
int
ret
=
0
;
if
(
Element
<
0
>::
get
(
tuple
)
!=
v
.
begin
())
{
...
...
This diff is collapsed.
Click to expand it.
common/tuples.hh
+
27
−
0
View file @
aa2e281e
...
...
@@ -469,6 +469,33 @@ namespace Dune
}
};
/**
* @brief Template meta_programm to query the size of a tuple
*
*/
template
<
typename
T
>
struct
Size
{
enum
{
/** @brief The value of the size of the tuple */
value
=
-
100000
};
};
template
<
typename
T1
,
typename
T2
>
struct
Size
<
Pair
<
T1
,
T2
>
>
{
enum
{
value
=
1
+
Size
<
T2
>::
value
};
};
template
<
typename
T1
>
struct
Size
<
Pair
<
T1
,
Nil
>
>
{
enum
{
value
=
1
};
};
/**
* @brief Equality comparison operator for tuples.
* @param tuple1 The first tuple.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment