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
Commits
1472ad96
Commit
1472ad96
authored
16 years ago
by
Markus Blatt
Browse files
Options
Downloads
Patches
Plain Diff
Fall back to alignment_of of tr1 if available.
[[Imported from SVN: r5420]]
parent
fc10bc11
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/alignment.hh
+14
-1
14 additions, 1 deletion
common/alignment.hh
with
14 additions
and
1 deletion
common/alignment.hh
+
14
−
1
View file @
1472ad96
...
...
@@ -4,6 +4,11 @@
#ifndef DUNE_ALIGNMENT_HH
#define DUNE_ALIGNMENT_HH
#include
<cstddef>
#ifdef HAVE_TR1_TYPE_TRAITS
#include
<type_traits>
#elif HAVE_TYPE_TRAITS
#include
<tr1/type_traits>
#endif
namespace
Dune
{
...
...
@@ -25,6 +30,7 @@ namespace Dune
{
char
c
;
T
t
;
void
hack
();
};
/** \todo Please doc me! */
...
...
@@ -75,10 +81,17 @@ namespace Dune
template
<
class
T
>
struct
AlignmentOf
{
enum
{
/** @brief The alginment requirement. */
value
=
AlignmentTester
<
T
,
sizeof
(
AlignmentStruct
<
T
>
)
-
sizeof
(
T
)
-
1
>::
result
#ifdef HAVE_TYPE_TRAITS
value
=
std
::
alignment_of
<
T
>::
value
#elif HAVE_TR1_TYPETRAITS
value
=
std
::
tr1
::
alignment_of
<
T
>::
value
#else
value
=
AlignmentTester
<
T
,
sizeof
(
AlignmentStruct
<
T
>
)
-
sizeof
(
T
)
-
1
>::
result
#endif
};
};
...
...
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