Boost logo

Boost Users :

From: Sergei Politov (spolitov_at_[hidden])
Date: 2008-02-29 23:25:07


Hi,

I suggest the following solution:
============================================================
template<class F>
void testEnum(const F & f)
{
    BOOST_STATIC_ASSERT(!boost::is_enum<boost::function_traits<boost::remove_pointer<F>::type
>::result_type >::value);
}

template <typename ContractType>
class C {
private:
    static void verify()
    {
        testEnum(&ContractType::st1);
        testEnum(&ContractType::st2);
    }
public:
    ~C() { verify(); }
};
============================================================

    The problem is "verify" function should be generated during compilation.
    If class "C" contains only static functions then you will have to invoke
"verify" from all of them, to guarantie that verify will be generated.
    In other case it is enough to invoke "verify" from destructor.

Best Regards,
  Sergei



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net