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
976d6dc3
Commit
976d6dc3
authored
16 years ago
by
Robert Klöfkorn
Browse files
Options
Downloads
Patches
Plain Diff
version 1.1.1 and ported tuples from trunk since not compiling with g++
4.3.x [[Imported from SVN: r5331]]
parent
927a02de
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
common/dlist.hh
+1
-1
1 addition, 1 deletion
common/dlist.hh
common/tuples.hh
+94
-31
94 additions, 31 deletions
common/tuples.hh
dune.module
+1
-1
1 addition, 1 deletion
dune.module
with
96 additions
and
33 deletions
common/dlist.hh
+
1
−
1
View file @
976d6dc3
...
...
@@ -81,7 +81,7 @@ namespace Dune {
//! empty constructor
DoubleLinkedList
()
DUNE_DEPRECATED
;
DoubleLinkedList
();
//! copy constructor
DoubleLinkedList
(
const
DoubleLinkedList
<
T
>&
);
...
...
This diff is collapsed.
Click to expand it.
common/tuples.hh
+
94
−
31
View file @
976d6dc3
...
...
@@ -6,12 +6,12 @@
#include
<ostream>
#include
"typetraits.hh"
#include
"static_assert.hh"
#include
"helpertemplates.hh"
#ifdef HAVE_TUPLE
#include
<tuple>
#endif
#ifdef HAVE_TR1_TUPLE
#elif defined HAVE_TR1_TUPLE
#include
<tr1/tuple>
#endif
...
...
@@ -438,8 +438,14 @@ namespace Dune {
#endif
#define ElementType tuple_element
#ifdef HAVE_TR1_TUPLE
#if defined HAVE_TUPLE || defined HAVE_TR1_TUPLE
#ifdef HAVE_TUPLE
#define TUPLE_NS std
using
std
::
get
;
#elif defined HAVE_TR1_TUPLE
#define TUPLE_NS std::tr1
using
std
::
tr1
::
get
;
#endif
// for backwards compatibility
template
<
int
i
>
...
...
@@ -447,33 +453,17 @@ namespace Dune {
template
<
typename
T1
>
static
typename
TupleAccessTraits
<
typename
tuple_element
<
i
,
T1
>::
type
>::
NonConstType
get
(
T1
&
t
)
{
return
std
::
tr1
::
get
<
i
>
(
t
);
return
TUPLE_NS
::
get
<
i
>
(
t
);
}
template
<
typename
T1
>
static
typename
TupleAccessTraits
<
typename
tuple_element
<
i
,
T1
>::
type
>::
ConstType
get
(
const
T1
&
t
)
{
return
std
::
tr1
::
get
<
i
>
(
t
);
return
TUPLE_NS
::
get
<
i
>
(
t
);
}
};
#elif defined HAVE_TUPLE
using
std
::
get
;
// for backwards compatibility
template
<
int
i
>
struct
Element
{
template
<
typename
T1
>
static
typename
TupleAccessTraits
<
typename
tuple_element
<
i
,
T1
>::
type
>::
NonConstType
get
(
T1
&
t
)
{
return
std
::
get
<
i
>
(
t
);
}
#undef TUPLE_NS
template
<
typename
T1
>
static
typename
TupleAccessTraits
<
typename
tuple_element
<
i
,
T1
>::
type
>::
ConstType
get
(
const
T1
&
t
)
{
return
std
::
get
<
i
>
(
t
);
}
};
#else
/**
* @brief Get the N-th element of a tuple.
...
...
@@ -548,12 +538,21 @@ namespace Dune {
return
Element
<
i
>::
get
(
t
);
}
template
<
int
i
,
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
,
typename
T5
,
typename
T6
,
typename
T7
,
typename
T8
,
typename
T9
>
typename
TupleAccessTraits
<
typename
tuple_element
<
i
,
tuple
<
T1
,
T2
,
T3
,
T4
,
T5
,
T6
,
T7
,
T8
,
T9
>
>::
type
>
::
ConstType
get
(
const
tuple
<
T1
,
T2
,
T3
,
T4
,
T5
,
T6
,
T7
,
T8
,
T9
>&
t
)
{
return
Element
<
i
>::
get
(
t
);
}
#endif
#ifdef HAVE_TR1_TUPLE
using
std
::
tr1
::
tuple_size
;
#elif defined HAVE_TUPLE
#ifdef HAVE_TUPLE
using
std
::
tuple_size
;
#elif defined HAVE_TR1_TUPLE
using
std
::
tr1
::
tuple_size
;
#else
/**
* @brief Template meta_programm to query the size of a tuple
...
...
@@ -592,13 +591,12 @@ namespace Dune {
#define Size tuple_size
#ifdef HAVE_TR1_TUPLE
using
std
::
tr1
::
tie
;
using
std
::
tr1
::
make_tuple
;
#endif
#ifdef HAVE_TUPLE
using
std
::
tie
;
using
std
::
make_tuple
;
#elif defined HAVE_TR1_TUPLE
using
std
::
tr1
::
tie
;
using
std
::
tr1
::
make_tuple
;
#endif
#if defined HAVE_TUPLE || defined HAVE_TR1_TUPLE
...
...
@@ -625,14 +623,78 @@ namespace Dune {
/**
* \brief Print a tuple.
*/
template
<
typename
T1
>
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
tuple
<
T1
>
&
t
)
{
typedef
tuple
<
T1
>
Tuple
;
return
tuple_writer
<
tuple_size
<
Tuple
>::
value
>::
put
(
os
,
t
);
}
template
<
typename
T1
,
typename
T2
>
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
tuple
<
T1
,
T2
>
&
t
)
{
typedef
tuple
<
T1
,
T2
>
Tuple
;
return
tuple_writer
<
tuple_size
<
Tuple
>::
value
>::
put
(
os
,
t
);
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
tuple
<
T1
,
T2
,
T3
>
&
t
)
{
typedef
tuple
<
T1
,
T2
,
T3
>
Tuple
;
return
tuple_writer
<
tuple_size
<
Tuple
>::
value
>::
put
(
os
,
t
);
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
>
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
tuple
<
T1
,
T2
,
T3
,
T4
>
&
t
)
{
typedef
tuple
<
T1
,
T2
,
T3
,
T4
>
Tuple
;
return
tuple_writer
<
tuple_size
<
Tuple
>::
value
>::
put
(
os
,
t
);
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
,
typename
T5
>
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
tuple
<
T1
,
T2
,
T3
,
T4
,
T5
>
&
t
)
{
typedef
tuple
<
T1
,
T2
,
T3
,
T4
,
T5
>
Tuple
;
return
tuple_writer
<
tuple_size
<
Tuple
>::
value
>::
put
(
os
,
t
);
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
,
typename
T5
,
typename
T6
>
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
tuple
<
T1
,
T2
,
T3
,
T4
,
T5
,
T6
>
&
t
)
{
typedef
tuple
<
T1
,
T2
,
T3
,
T4
,
T5
,
T6
>
Tuple
;
return
tuple_writer
<
tuple_size
<
Tuple
>::
value
>::
put
(
os
,
t
);
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
,
typename
T5
,
typename
T6
,
typename
T7
>
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
tuple
<
T1
,
T2
,
T3
,
T4
,
T5
,
T6
,
T7
>
&
t
)
{
typedef
tuple
<
T1
,
T2
,
T3
,
T4
,
T5
,
T6
,
T7
>
Tuple
;
return
tuple_writer
<
tuple_size
<
Tuple
>::
value
>::
put
(
os
,
t
);
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
,
typename
T5
,
typename
T6
,
typename
T7
,
typename
T8
>
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
tuple
<
T1
,
T2
,
T3
,
T4
,
T5
,
T6
,
T7
,
T8
>
&
t
)
{
typedef
tuple
<
T1
,
T2
,
T3
,
T4
,
T5
,
T6
,
T7
,
T8
>
Tuple
;
return
tuple_writer
<
tuple_size
<
Tuple
>::
value
>::
put
(
os
,
t
);
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
,
typename
T5
,
typename
T6
,
typename
T7
,
typename
T8
,
typename
T9
>
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
tuple
<
T1
,
T2
,
T3
,
T4
,
T5
,
T6
,
T7
,
T8
,
T9
>
t
)
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
tuple
<
T1
,
T2
,
T3
,
T4
,
T5
,
T6
,
T7
,
T8
,
T9
>
&
t
)
{
typedef
tuple
<
T1
,
T2
,
T3
,
T4
,
T5
,
T6
,
T7
,
T8
,
T9
>
Tuple
;
return
tuple_writer
<
tuple_size
<
Tuple
>::
value
>::
put
(
os
,
t
);
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
,
typename
T5
,
typename
T6
,
typename
T7
,
typename
T8
,
typename
T9
,
typename
T10
>
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
tuple
<
T1
,
T2
,
T3
,
T4
,
T5
,
T6
,
T7
,
T8
,
T9
,
T10
>
&
t
)
{
typedef
tuple
<
T1
,
T2
,
T3
,
T4
,
T5
,
T6
,
T7
,
T8
,
T9
,
T10
>
Tuple
;
return
tuple_writer
<
tuple_size
<
Tuple
>::
value
>::
put
(
os
,
t
);
}
#else
/**
...
...
@@ -688,7 +750,8 @@ namespace Dune {
template
<
typename
T1
,
typename
U1
>
inline
bool
operator
!=
(
const
Pair
<
T1
,
Nil
>&
tuple1
,
const
Pair
<
U1
,
Nil
>&
tuple2
)
{
IsTrue
<
IsInteroperable
<
T1
,
U1
>::
value
>::
yes
();
dune_static_assert
((
IsInteroperable
<
T1
,
U1
>::
value
),
"T1 and U1 have to be interoperable, "
<<
"i.e. either conversion from one to the other must exist!"
);
return
(
tuple1
.
first
()
!=
tuple2
.
first
());
}
...
...
This diff is collapsed.
Click to expand it.
dune.module
+
1
−
1
View file @
976d6dc3
Module
:
dune
-
common
Version
:
1.1
Version
:
1.1
.1
Maintainer
:
dune
@
dune
-
project
.
org
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