language: C++11 (gcc-4.7.2)
date: 705 days 7 hours ago
link:
visibility: private
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
                                                                                                                                                                                                template<class C, class R> struct proxy{ typedef R(C::*Fty)(); proxy(Fty f) : _f(f){} Fty _f;};
class testWorld {
    public:
        testWorld() {}
        ~testWorld() {}
        void initPhysics();
};                                                                                                                                                                                              template<class C, class R> proxy<C,R> operator-(proxy<C,R> prox){ return prox; }
                                                                                                                                                                                                proxy<testWorld,void> initPhysics(){ return &testWorld::initPhysics; }
void testWorld::initPhysics() {
    std::cout << "Initiating physics..." << std::endl;
}
                                                                                                                                                                                                template<class C, class R> auto operator<(C* obj, proxy<C,R> prox) -> decltype((obj->*prox._f)()){ return (obj->*prox._f)(); }
int main(int argc,char** argv) {
    std::cout << "Hello World!" << std::endl;
    testWorld* world;
    world = new testWorld();
    world<-initPhysics();
    return 0;
}