Boost logo

Boost :

Subject: [boost] [introspection] if a function is not public
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2011-06-29 20:02:20


Hello all,

Is there any way (SFINAE, etc) to check at run-time or at compile-time
if a member function is not public?

class x {
public:
    void f ( ) {};
protected:
    void g ( ) {};
private:
    void h ( ) {};

    bool is_public(...) { ... } // some implementation

    void check ( ) {
        std::cout << is_public(x::f) << std::endl; // 1
        std::cout << is_public(x::g) << std::endl; // 0
        std::cout << is_public(x::h) << std::endl; // 0
    }
};

Thanks a lot!
--Lorenzo


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk