fork download
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. template<class T> struct Help
  5. {
  6. static size_t doSomething()
  7. {
  8. cout<<"calling Work with param U"; return sizeof(T);
  9. }
  10. };
  11. template<> struct Help<float>
  12. {
  13. static size_t doSomething()
  14. {
  15. cout<<"calling Work with param float"; return sizeof(float);
  16. }
  17. };
  18.  
  19. template <class T, template <class> class V> struct CAttrib : Help<T>{};
  20.  
  21.  
  22. template<class T> struct Test {};
  23.  
  24. int main()
  25. {
  26. cout<< CAttrib<int, Test>::doSomething()<<endl;
  27. cout<< CAttrib<float, Test>::doSomething()<<endl;
  28. }
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
calling Work with param U4
calling Work with param float4