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

Helper templates now in namespace Dune. This fixes FlySpray entry 392.

[[Imported from SVN: r5399]]
parent f009976a
No related branches found
No related tags found
No related merge requests found
...@@ -9,36 +9,40 @@ ...@@ -9,36 +9,40 @@
\brief Compile-time constraint checks from the Stroustrup FAQ \brief Compile-time constraint checks from the Stroustrup FAQ
*/ */
/** namespace Dune {
Derived_from<A,B>();
/**
or Derived_from<A,B>();
template<class T> class Container : Derived_from<T,Mybase> { or
...
}; template<class T> class Container : Derived_from<T,Mybase> {
*/ ...
template<class T, class B> struct Derived_from { };
static void constraints(T* p) { B* pb = p; } */
Derived_from() { void (*p)(T*) = constraints; } template<class T, class B> struct Derived_from {
}; static void constraints(T* p) { B* pb = p; }
Derived_from() { void (*p)(T*) = constraints; }
/** \todo Please doc me! */ };
template<class T1, class T2> struct Can_copy {
static void constraints(T1 a, T2 b) { T2 c = a; b = a; } /** \todo Please doc me! */
Can_copy() { void (*p)(T1,T2) = constraints; } template<class T1, class T2> struct Can_copy {
}; static void constraints(T1 a, T2 b) { T2 c = a; b = a; }
Can_copy() { void (*p)(T1,T2) = constraints; }
/** \todo Please doc me! */ };
template<class T1, class T2 = T1> struct Can_compare {
static void constraints(T1 a, T2 b) { a==b; a!=b; a<b; } /** \todo Please doc me! */
Can_compare() { void (*p)(T1,T2) = constraints; } template<class T1, class T2 = T1> struct Can_compare {
}; static void constraints(T1 a, T2 b) { a==b; a!=b; a<b; }
Can_compare() { void (*p)(T1,T2) = constraints; }
/** \todo Please doc me! */ };
template<class T1, class T2, class T3 = T1> struct Can_multiply {
static void constraints(T1 a, T2 b, T3 c) { c = a*b; } /** \todo Please doc me! */
Can_multiply() { void (*p)(T1,T2,T3) = constraints; } template<class T1, class T2, class T3 = T1> struct Can_multiply {
}; static void constraints(T1 a, T2 b, T3 c) { c = a*b; }
Can_multiply() { void (*p)(T1,T2,T3) = constraints; }
};
} // namespace Dune
#endif #endif
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