You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Standard frequently uses "Effects: Equivalent to" when specifying things. This is awesome because it provides an implementation that can be used in production code, nearly unchanged, 99% of the time. (Occasionally, a more efficient implementation is possible.)
For example, shared_ptr's assignment from unique_ptris specified as:
Effects: Equivalent to shared_ptr(std::move(r)).swap(*this).
However, shared_ptr's constructor from unique_ptris constrained (currently with old-style wording):
Remarks: This constructor shall not participate in overload resolution unless Y* is compatible with T* and unique_ptr<Y, D>::pointer is convertible to element_type*.
Finally, the Standard's Library-wide wording says:
Whenever the Effects element specifies that the semantics of some function F are Equivalent to some code sequence, then the various elements are interpreted as follows. If F's semantics specifies any Constraints or Mandates elements, then those requirements are logically imposed prior to the equivalent-to semantics.
We've never implemented that. For example, we constrain the constructor:
shared_ptr& operator=(unique_ptr<_Ux, _Dx>&& _Right) { // move from unique_ptr
shared_ptr(_STD move(_Right)).swap(*this);
return *this;
}
This is a bug because the difference is detectable through is_assignable.
The extent of this problem is unknown. I don't know of a better way to thoroughly fix this issue than going through every occurrence of "Effects: Equivalent to" in the Standard and looking for expressions that involve constrained machinery.
The text was updated successfully, but these errors were encountered:
The Standard frequently uses "Effects: Equivalent to" when specifying things. This is awesome because it provides an implementation that can be used in production code, nearly unchanged, 99% of the time. (Occasionally, a more efficient implementation is possible.)
For example,
shared_ptr
's assignment fromunique_ptr
is specified as:However,
shared_ptr
's constructor fromunique_ptr
is constrained (currently with old-style wording):Finally, the Standard's Library-wide wording says:
We've never implemented that. For example, we constrain the constructor:
STL/stl/inc/memory
Lines 1109 to 1113 in 6b0238d
But we don't constrain the assignment operator:
STL/stl/inc/memory
Lines 1162 to 1166 in 6b0238d
This is a bug because the difference is detectable through
is_assignable
.The extent of this problem is unknown. I don't know of a better way to thoroughly fix this issue than going through every occurrence of "Effects: Equivalent to" in the Standard and looking for expressions that involve constrained machinery.
The text was updated successfully, but these errors were encountered: