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
fb4be5df
Commit
fb4be5df
authored
19 years ago
by
Oliver Sander
Browse files
Options
Downloads
Patches
Plain Diff
minor doc improvement
[[Imported from SVN: r3678]]
parent
d4a042b2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/helpertemplates.hh
+9
-5
9 additions, 5 deletions
common/helpertemplates.hh
with
9 additions
and
5 deletions
common/helpertemplates.hh
+
9
−
5
View file @
fb4be5df
...
...
@@ -5,11 +5,11 @@
#ifndef DUNE_COMMON_HELPERTEMPLATES
#define DUNE_COMMON_HELPERTEMPLATES
/*
Compile-time constraint checks from the Stroustrup FAQ
/*
* \file
\brief
Compile-time constraint checks from the Stroustrup FAQ
*/
/*
/*
*
Derived_from<A,B>();
or
...
...
@@ -23,23 +23,25 @@ template<class T, class B> struct Derived_from {
Derived_from
()
{
void
(
*
p
)(
T
*
)
=
constraints
;
}
};
/** \todo Please doc me! */
template
<
class
T1
,
class
T2
>
struct
Can_copy
{
static
void
constraints
(
T1
a
,
T2
b
)
{
T2
c
=
a
;
b
=
a
;
}
Can_copy
()
{
void
(
*
p
)(
T1
,
T2
)
=
constraints
;
}
};
/** \todo Please doc me! */
template
<
class
T1
,
class
T2
=
T1
>
struct
Can_compare
{
static
void
constraints
(
T1
a
,
T2
b
)
{
a
==
b
;
a
!=
b
;
a
<
b
;
}
Can_compare
()
{
void
(
*
p
)(
T1
,
T2
)
=
constraints
;
}
};
/** \todo Please doc me! */
template
<
class
T1
,
class
T2
,
class
T3
=
T1
>
struct
Can_multiply
{
static
void
constraints
(
T1
a
,
T2
b
,
T3
c
)
{
c
=
a
*
b
;
}
Can_multiply
()
{
void
(
*
p
)(
T1
,
T2
,
T3
)
=
constraints
;
}
};
/*
helper template so that compilation fails if condition is not true
/** \brief Helper template so that compilation fails if condition is not true
*/
template
<
bool
condition
>
struct
IsTrue
...
...
@@ -47,6 +49,8 @@ struct IsTrue
static
void
no
()
{};
};
/** \brief Helper template so that compilation fails if condition is not true
*/
template
<
>
struct
IsTrue
<
true
>
{
...
...
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