|
Boost : |
Subject: Re: [boost] Updated boost::base_from_member for C++2011
From: Daryle Walker (darylew_at_[hidden])
Date: 2012-02-17 02:46:46
> From: me
> Date: Wed, 15 Feb 2012 23:19:46 -0500
>
> > From: me
> > Date: Tue, 14 Feb 2012 11:08:10 -0500
> >
[SNIP]
> > Any ideas for a fix? Does there need to be explicitly declared copy (and move) constructors?
>
>
> I asked about this on StackOverflow, and we've discovered a new C++ gotcha. If we have a universal constructor:
[SNIP]> Although constructor templates are ignored when determining if the automatic copy/move-constructors are made, they are NOT ignored when overload resolution needs to be done! If you're copying from a non-const object, the universal constructor will match a "MyType &" before the copy constructor's "MyType const &" would! This is what's causing the conflict.
> The way around it is to add an "unused" EnableIf template parameter to the constructor template that cancels the template when Args is a single argument and the argument's type is MyType.
> I'll work that in.
I did it in (https://svn.boost.org/trac/boost/changeset/77046), so check if it works for you now. Of course, if you or someone else here has a better construction, let me know and I'll try it instead. (It still has to work for me on GCC-4.6, though.)
Daryle W.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk