fork download
  1. #include <string>
  2.  
  3.  
  4. template <bool A=true, bool B=false>
  5. struct from {
  6. const static std::string value;
  7. };
  8.  
  9. // no specialization - works
  10. template <bool A, bool B>
  11. const std::string from<A, B>::value = "";
  12.  
  13. // partial specialization - does not compile -
  14. // Error: template argument list following class template name must list parameters in the // order used in template parameter list
  15. template <bool B>
  16. const std::string from<true, B>::value = "";
  17.  
  18. // full specialization - works
  19. const std::string from<false, true>::value = "";
  20.  
  21.  
  22. int main() {
  23. return 0;
  24. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:16: error: template definition of non-template ‘const std::string from<true, B>::value’
prog.cpp:19: error: too few template-parameter-lists
stdout
Standard output is empty