Guest User

Untitled

a guest
Jan 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. template<class T> class ref_ptr;
  2. struct Foo {
  3.   typedef ref_ptr<const Foo> Ptr;
  4. };
  5. template<typename T> struct Exp {
  6.   Exp();
  7.   template<typename OtherT> Exp(const OtherT &value);
  8. };
  9. template <typename MethodT> struct MethodInfo;
  10. template <typename ObjectT, typename ResultT> struct MethodInfo<ResultT (ObjectT::*)() const> {
  11.   typedef const ObjectT Object;
  12. };
  13. template<typename MethodT> Exp<void> Call(const Exp<typename MethodInfo<MethodT>::Object *> &object, MethodT method) {
  14. }
  15. template<typename MethodT> Exp<void> Call(const Exp<ref_ptr<typename MethodInfo<MethodT>::Object> > &object, MethodT method) {
  16. }
  17. template<typename ObjectT> struct SingleRecordFoo : public Foo {
  18.   void id() const;
  19. };  
  20. struct ObservedThing : public SingleRecordFoo<ObservedThing> {
  21.   void f() {
  22.     Exp<ObservedThing::Ptr> thing;
  23.     (void)Call(thing, &ObservedThing::id);
  24.   }
  25. };
Add Comment
Please, Sign In to add comment