fork(9) download
  1. #include <type_traits>
  2.  
  3. template<typename T> struct fake_dependency : public std::false_type { };
  4. template<class Foo> void func(Foo x) {
  5. static_assert(fake_dependency<Foo>::value, "must use specialization");
  6. }
  7.  
  8. template<> void func<double>(double x) {
  9. // Yay!
  10. }
  11.  
  12. int main() {
  13. // func<int>(1); // fails.
  14. func<double>(1); // succeeds.
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
Standard output is empty