
On Sat, Aug 6, 2011 at 1:38 AM, John Maddock <boost.regex@virgin.net> wrote:
Folks, I have a problem with enable_if: it works just dandy for template member functions in my class, but I have some *non-template* member functions and constructors that I want to enable only if the template is instantiated with template args that meet certain criteria. Seems like I can't do this with enable_if as it then generates an invalid class definition. I guess I could use base classes, and/or partial specialization, but both involve a lot of code duplication I'd rather not have. Anyone any ideas?
I'm afraid what I'm suggesting is obvious and you probably thought of it already but you could convert your design to use namespace-scope function templates instead of member functions of a class template. If you insist on the member function call syntax, you could add member functions that forward to the (enable-iffed) namespace-scope functions. Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode