fork(17) download
  1. template<bool> struct Range;
  2.  
  3. template<int val, typename = Range<true> >
  4. class Param
  5. {
  6. public:
  7. typedef char type;
  8. };
  9.  
  10. template<int val>
  11. class Param<val, Range<(0 <= val && val <= 100)> >
  12. {
  13. public:
  14. typedef int type;
  15. };
  16.  
  17. template<int val>
  18. class Param<val, Range<(100 < val && val <= 175)> >
  19. {
  20. public:
  21. typedef double type;
  22. };
  23.  
  24. int main ()
  25. {
  26. Param<200>::type *p1 = new char;
  27. Param<100>::type *p2 = new int;
  28. Param<110>::type *p3 = new double;
  29. }
  30.  
Success #stdin #stdout 0.01s 2852KB
stdin
Standard input is empty
stdout
Standard output is empty