Boost logo

Boost Users :

Subject: [Boost-users] generic programming : variadic virtual function
From: Stephen Nuchia (snuchia_at_[hidden])
Date: 2009-08-25 18:31:56


I'm finally doing something nontrivial with templates and I've painted
myself into an interesting corner. boost::enable_if looks like it might
be a solution but I've not made it work yet.

extracting the essence of the situation:

template<typename S, typename W>
class baseclass
{
        virtual void operator()(S s, W w) = 0;
}

template<typename S>
class baseclass<S,void>
{
        virtual void operator()(S s) = 0;
}

template<typename S, typename W = void>
class derived : public baseclass<S,W>
{
        void operator()(S s); // if W is void
        void operator()(S s, W w); // otherwise
}

How can I make this work? MSVC9, if that makes a difference. I tried
adapting some examples from the enable_if documentation but that led to
wandering around aimlessly making random changes to the text.

TIA,
-swn


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