fork(1) download
  1. template<class T, class R = void>
  2. struct enable_if_type
  3. {
  4. typedef R type;
  5. };
  6.  
  7. template<class E, class Enable = void>
  8. struct GetFloatType
  9. {
  10. typedef E type;
  11. };
  12.  
  13. template<class E>
  14. struct GetFloatType<E, typename enable_if_type<typename E::Scalar>::type>
  15. {
  16. typedef typename E::Scalar type;
  17. };
  18.  
  19.  
  20. template <class Elemtype, class Floattype = typename GetFloatType<Elemtype>::type>
  21. class ExponentialSmoother
  22. {
  23. // ...
  24. };
  25.  
  26. template<typename T>
  27. class Vector
  28. {
  29. public:
  30. typedef T Scalar;
  31. };
  32.  
  33. template<typename T>
  34. class Vector2
  35. {
  36. };
  37.  
  38. int main()
  39. {
  40. ExponentialSmoother<Vector<float> > a;
  41. ExponentialSmoother<Vector2<float> > b;
  42. ExponentialSmoother<double> c;
  43. }
Success #stdin #stdout 0.01s 2720KB
stdin
Standard input is empty
stdout
Standard output is empty