Guest User

Untitled

a guest
May 22nd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. //SGObject.h
  2. public:
  3.     template<class T>
  4.     bool equals(const Some<T> & other, float64_t accuracy=0.0, bool tolerant=false)
  5.     {
  6.         equals_impl(some_dynamic_cast<CSGObject>(other), accuracy, tolerant);
  7.     };
  8.  
  9. protected:
  10.     virtual bool equals_impl(const Some<CSGObject> & other, float64_t accuracy=0.0, bool tolerant=false)
  11.     {
  12.         /** actual equals code **/
  13.     }
  14.  
  15. //some.h
  16. template <typename U, typename T>
  17.     Some<U> some_dynamic_cast(const Some<T> & other)
  18.     {
  19.         U * tmp = dynamic_cast<U*>(other.get());
  20.         if (tmp==NULL)
  21.             return Some<U>::from_raw(nullptr);
  22.         return Some<U>::from_raw(tmp);
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment