Home Class acting as transparent Facade
Reply: 0

Class acting as transparent Facade

user1506 Published in March 24, 2018, 12:33 am

I'm not sure of the best way to describe this, or how to create a minimal compilable example, but I want to use these four registerCallback methods in my own templated class. Rather than create four explicit methods in my own code, I'd like to do something like this:

class MyClass
    std::unique_ptr<Synchronizer<MyPolicy>> m_sync;

    Connection <what goes here?>()
        return m_sync.registerCallback(<what goes here?>);

    // Current workaround
    Synchronizer<MyPolicy> &sync() { return *m_sync; }
    Synchronizer<MyPolicy> const sync() const { return *m_sync; }

Usage would be something like:

std::unique_ptr<MyClass> sync = std::unique_ptr<MyClass>(new MyClass);
                                   this, _1, _2));

My current usage is to just to call the getter:

std::unique_ptr<MyClass> sync = std::unique_ptr<MyClass>(new MyClass);
                                          this, _1, _2));

Is there template trickery that can solve my problem? I saw this page referenced in another question, but things seem to be complicated by the Synchronizer class having the copy constructor = delete.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.297828 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO