Skip to content
Snippets Groups Projects
Commit 98a883ae authored by Oliver Sander's avatar Oliver Sander
Browse files

get ready for gcc-4.3 which has tuple in std:: instead of std::tr1::

[[Imported from SVN: r4958]]
parent 5a959db9
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
#include "typetraits.hh" #include "typetraits.hh"
#include "helpertemplates.hh" #include "helpertemplates.hh"
#ifdef HAVE_TUPLE
#include <tuple>
#endif
#ifdef HAVE_TR1_TUPLE #ifdef HAVE_TR1_TUPLE
#include <tr1/tuple> #include <tr1/tuple>
#endif #endif
...@@ -55,7 +58,9 @@ namespace Dune { ...@@ -55,7 +58,9 @@ namespace Dune {
typedef T& ParameterType; typedef T& ParameterType;
}; };
#ifdef HAVE_TR1_TUPLE #ifdef HAVE_TUPLE
using std::tuple;
#elif defined HAVE_TR1_TUPLE
using std::tr1::tuple; using std::tr1::tuple;
#else #else
/** /**
...@@ -389,7 +394,9 @@ namespace Dune { ...@@ -389,7 +394,9 @@ namespace Dune {
// be backwards compatible // be backwards compatible
#define Tuple tuple #define Tuple tuple
#ifdef HAVE_TR1_TUPLE #ifdef HAVE_TUPLE
using std::tuple_element;
#elif defined HAVE_TR1_TUPLE
using std::tr1::tuple_element; using std::tr1::tuple_element;
#else #else
/** /**
...@@ -434,7 +441,7 @@ namespace Dune { ...@@ -434,7 +441,7 @@ namespace Dune {
#ifdef HAVE_TR1_TUPLE #ifdef HAVE_TR1_TUPLE
using std::tr1::get; using std::tr1::get;
// for backwards compartibility // for backwards compatibility
template<int i> template<int i>
struct Element { struct Element {
template<typename T1> template<typename T1>
...@@ -449,6 +456,24 @@ namespace Dune { ...@@ -449,6 +456,24 @@ namespace Dune {
return std::tr1::get<i>(t); return std::tr1::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);
}
template<typename T1>
static typename TupleAccessTraits<typename tuple_element<i,T1>::type>::ConstType get(const T1& t)
{
return std::get<i>(t);
}
};
#else #else
/** /**
* @brief Get the N-th element of a tuple. * @brief Get the N-th element of a tuple.
...@@ -527,6 +552,8 @@ namespace Dune { ...@@ -527,6 +552,8 @@ namespace Dune {
#ifdef HAVE_TR1_TUPLE #ifdef HAVE_TR1_TUPLE
using std::tr1::tuple_size; using std::tr1::tuple_size;
#elif defined HAVE_TUPLE
using std::tuple_size;
#else #else
/** /**
* @brief Template meta_programm to query the size of a tuple * @brief Template meta_programm to query the size of a tuple
...@@ -562,7 +589,13 @@ namespace Dune { ...@@ -562,7 +589,13 @@ namespace Dune {
#ifdef HAVE_TR1_TUPLE #ifdef HAVE_TR1_TUPLE
using std::tr1::tie; using std::tr1::tie;
using std::tr1::make_tuple; using std::tr1::make_tuple;
#endif
#ifdef HAVE_TUPLE
using std::tie;
using std::make_tuple;
#endif
#if defined HAVE_TUPLE || defined HAVE_TR1_TUPLE
template<int i> template<int i>
struct tuple_writer struct tuple_writer
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment