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
93f16b5e
Commit
93f16b5e
authored
9 years ago
by
Lars Lubkoll
Browse files
Options
Downloads
Patches
Plain Diff
Cleaned up field_t, real_t, improved comment for voider
parent
9d86c6d0
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
dune/common/typetraits.hh
+14
-29
14 additions, 29 deletions
dune/common/typetraits.hh
with
14 additions
and
29 deletions
dune/common/typetraits.hh
+
14
−
29
View file @
93f16b5e
...
...
@@ -533,50 +533,35 @@ namespace Dune
namespace
detail
{
/// @internal
/// helper to make void_t work with gcc
///
/**
* @internal
* @brief Helper to make void_t work with gcc versions prior to gcc 5.0.
*
* This was not a compiler bug, but an accidental omission in the C++11 standard. It is not clearly specified what happens
* with unused template arguments in template aliases. The developers of GCC decided to ignore them, thus making void_t equivalent to void.
* With gcc 5.0 this was changed and the voider-hack is no longer needed.
*/
template
<
class
...
>
struct
voider
{
using
type
=
void
;
};
template
<
class
,
class
=
void
>
class
Real_t
;
}
template
<
class
>
struct
FieldTraits
;
/**
* @brief Is void for all valid input types.
*
* The workhorse for C++11 SFINAE-techniques.
*/
//! Is void for all valid input types. The workhorse for C++11 SFINAE-techniques.
template
<
class
...
Types
>
using
void_t
=
typename
detail
::
voider
<
Types
...
>::
type
;
//! Convenient access to Type::field_type.
//! Convenient access to
FieldTraits<
Type
>
::field_type.
template
<
class
Type
>
using
field_t
=
typename
Type
::
field_type
;
using
field_t
=
typename
FieldTraits
<
Type
>
::
field_type
;
//! Convenient access to
Type::real_type, resp.
FieldTraits<Type
::field_type
>::real_type.
//! Convenient access to FieldTraits<Type>::real_type.
template
<
class
Type
>
using
real_t
=
typename
detail
::
Real_t
<
Type
>::
type
;
namespace
detail
{
template
<
class
Type
,
class
>
struct
Real_t
{
using
type
=
typename
FieldTraits
<
Type
>::
real_type
;
};
template
<
class
Type
>
struct
Real_t
<
Type
,
void_t
<
field_t
<
Type
>
>
>
{
using
type
=
typename
Real_t
<
field_t
<
Type
>
>::
type
;
};
}
using
real_t
=
typename
FieldTraits
<
Type
>::
real_type
;
/** @} */
}
...
...
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