what about (following need c++11, but it could be ported to c++99 (except the 'template using') ):
class Channel {
public:
virtual ~Channel();
protected:
Channel(int direction, int size);
};
template<bool forward, bool zero>
class ChannelT : public Channel {
public:
template <bool b = zero, typename T = typename std::enable_if<b>::type>
ChannelT() : Channel(forward ? 1 : 0, 0) {}
template <bool b = zero, typename T = typename std::enable_if<!b>::type>
explicit ChannelT(int size) : Channel(forward ? 1 : 0, size) { assert(size != 0); }
};
template <bool zero> using ForwardChannel = ChannelT<true, zero>;
using ForwardZeroChannel = ChannelT<true, true>;
using ForwardNonZeroChannel = ChannelT<true, false>;
// And so on for the 5 other types...
int main() {
ForwardZeroChannel forwardZeroChannel;
ForwardNonZeroChannel forwardNonZeroChannel(42);
return 0;
}