Skip to content
Snippets Groups Projects
Commit aa2e281e authored by Markus Blatt's avatar Markus Blatt
Browse files

Added size method.

[[Imported from SVN: r4952]]
parent f5cdbd5d
No related branches found
No related tags found
No related merge requests found
......@@ -39,6 +39,8 @@ int iteratorTupleTest()
Tuple tuple(v.begin(), v.begin(), v.end());
assert(Size<Tuple>::value==3);
int ret=0;
if(Element<0>::get(tuple)!= v.begin()) {
......
......@@ -469,6 +469,33 @@ namespace Dune
}
};
/**
* @brief Template meta_programm to query the size of a tuple
*
*/
template<typename T>
struct Size
{
enum {
/** @brief The value of the size of the tuple */
value = -100000
};
};
template<typename T1, typename T2>
struct Size<Pair<T1,T2> >
{
enum { value=1+Size<T2>::value};
};
template<typename T1>
struct Size<Pair<T1,Nil> >
{
enum { value=1};
};
/**
* @brief Equality comparison operator for tuples.
* @param tuple1 The first tuple.
......
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