fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <typename Coordinate>
  5. class BoundingTree
  6. {
  7. public:
  8. BoundingTree() {}
  9.  
  10. // collide function decleration
  11. template <typename RigidBody> bool collide(RigidBody const & obj);
  12.  
  13. };
  14.  
  15. template<typename Coordinate> template <typename RigidBody>
  16. bool BoundingTree<Coordinate>::collide(RigidBody const & obj)
  17. {
  18. std::cout << "default" << std::endl;
  19. return false;
  20. }
  21.  
  22. template<> template<>
  23. bool BoundingTree<double>::collide<int>(int const & d)
  24. {
  25. std::cout << "Vector3f Sphere3f" << std::endl;
  26. return 1;
  27. };
  28.  
  29. int main() {
  30. BoundingTree<double> tree;
  31. tree.collide(50);
  32.  
  33. BoundingTree<bool> tree2;
  34. tree2.collide(100);
  35. return 0;
  36. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
Vector3f Sphere3f
default