
On Sunday, February 14, 2016 at 9:18:15 PM UTC-6, Peter Dimov wrote:
Paul Fultz II wrote:
One way to deal with this is to put it into boost::optional.
boost::optional<T> uses T::operator= when the source and the target hold a value.
It seems that boost::optional is not constrained properly, the following compiles just fine: struct not_assignable { not_assignable& operator=(const not_assignable&)=delete; }; static_assert(!std::is_copy_assignable<not_assignable>(), "Assignable"); static_assert(std::is_copy_assignable<boost::optional<not_assignable>>(), "Not Assignable"); However, if I use the assignment operator, it breaks with a compile error. Either way `boost::optional` should fallback on in-place new, when there is no assignment operator.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost