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
C.46 currently just says that nonexplicit single-argument constructors are rarely justified and suggests warning for any that aren't on some whitelist. Then the GSL section recommends making intent explicit with the nonstandard attribute [[implicit]].
Since C++20 introduced conditionally explicit specifiers, we can express this portably with explicit(false):
classComplex {
public:explicit(false) Complex(double d); // OK: we want a conversion from d to {d, 0}// ...
};
Complex z = 10.7; // unsurprising conversion
C.46 currently just says that nonexplicit single-argument constructors are rarely justified and suggests warning for any that aren't on some whitelist. Then the GSL section recommends making intent explicit with the nonstandard attribute
[[implicit]]
.Since C++20 introduced conditionally explicit specifiers, we can express this portably with
explicit(false)
:(I first saw this in P3094's sample implementation of
basic_fixed_string
.)The text was updated successfully, but these errors were encountered: