This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.
2411.shared_ptr
is only contextually convertible to bool
Section: 20.3.2.2 [util.smartptr.shared] Status: C++17 Submitter: Jonathan Wakely Opened: 2014-06-21 Last modified: 2017-07-30
Priority: 0
View all other issues in [util.smartptr.shared].
View all issues with C++17 status.
Discussion:
N3920 made this edit, which is correct but unrelated to the support for arrays:
Change 20.7.2.2 [util.smartptr.shared] p2 as follows:
Specializations of
shared_ptr
shall beCopyConstructible
,CopyAssignable
, andLessThanComparable
, allowing their use in standard containers. Specializations ofshared_ptr
shall be contextually convertible tobool
, allowing their use in boolean expressions and declarations in conditions. […]
That change is actually fixing a defect in the current wording and should be applied directly to the working paper, not just to the Library Fundamentals TS. The declarations of the conversion operator in 20.3.2.2 [util.smartptr.shared] and 20.3.2.2.6 [util.smartptr.shared.obs] are explicit
which contradicts the "convertible to bool
" statement. The intention is definitely for shared_ptr
to only be contextually convertible to bool
.
[Urbana 2014-11-07: Move to Ready]
Proposed resolution:
This wording is relative to N3936.
Change 20.3.2.2 [util.smartptr.shared] p2 as indicated:
-2- Specializations of
shared_ptr
shall beCopyConstructible
,CopyAssignable
, andLessThanComparable
, allowing their use in standard containers. Specializations ofshared_ptr
shall be contextually convertible tobool
, allowing their use in boolean expressions and declarations in conditions. The template parameterT
ofshared_ptr
may be an incomplete type.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4