This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++23 status.
3411. [fund.ts.v3] Contradictory namespace rules in the Library Fundamentals TSSection: 8.3 [fund.ts.v3::memory.resource.syn] Status: C++23 Submitter: Thomas Köppe Opened: 2020-02-28 Last modified: 2023-11-22
Priority: 3
View all issues with C++23 status.
Discussion:
Addresses: fund.ts.v3
The Library Fundamentals TS, N4840, contains a rule about the use of namespaces (paragraph 1), with the consequence:
"This TS does not define
std::experimental::fundamentals_v3::pmr
"
However, the TS then goes on to define exactly that namespace.
At the time when the subclause memory.resource.syn was added, the IS didn't use to contain a namespacepmr
. When the IS adopted that namespace and the TS was rebased, the namespace rule started conflicting with the material in the TS. I do not have a workable proposed resolution at this point.
[2020-04-07 Issue Prioritization]
Priority to 3 after reflector discussion.
[2021-11-17; Jiang An comments and provides wording]
Given namespaces std::chrono::experimental::fundamentals_v2
and std::experimental::fundamentals_v2::pmr
are used in LFTS v2, I think that the intent is that
the prefix experimental::fundamentals_vN
is only added to a namespace specified by the standard, and
every name specified by the standard in the outer namespace of that of the related component in the TS.
If we follow the convention, perhaps we should relocate resource_adaptor
from std::experimental::fundamentals_v3::pmr
to std::pmr::experimental::fundamentals_v3
in LFTS v3. If it's decided that resource_adaptor
shouldn't be relocated, I suppose that LWG 3411 can be by striking the wrong wording in 4.1 [fund.ts.v3::general.namespaces] and using qualified std::pmr::memory_resource
when needed.
Previous resolution [SUPERSEDED]:
This wording is relative to N4853.
[Drafting Note: Two mutually exclusive options are prepared, depicted below by Option A and Option B, respectively.]
Option A:
Modify 4.1 [fund.ts.v3::general.namespaces] as indicated:
-2- Each header described in this technical specification shall import the contents of
outer-namespace std::experimental::fundamentals_v3
intoouter-namespace std::experimental
as if bynamespace outer-namespacestd::experimental::inline fundamentals_v3 {}where
outer-namespace
is a namespace defined in the C++ Standard Library.Modify [fund.ts.v3::memory.type.erased.allocator], Table 5, as indicated:
Table 5 — Computedmemory_resource
for type-erased allocator If the type ofalloc
is then the value ofrptr
is[…]
any other type meeting the requirements (C++20 ¶16.5.3.5) a pointer to a value of typepmr:: experimental::resource_adaptor<A>
whereA
is the type ofalloc
.rptr
remains valid only for the lifetime ofX
.[…]
Modify 8.3 [fund.ts.v3::memory.resource.syn], header
<experimental/memory_resource>
synopsis, as indicated:namespace std::pmr::experimental::inline fundamentals_v3::pmr { […] } // namespace std::pmr::experimental::inline fundamentals_v3::pmrOption B:
Modify 4.1 [fund.ts.v3::general.namespaces] as indicated:
-1- Since the extensions described in this technical specification are experimental and not part of the C++ standard library, they should not be declared directly within namespace
std
. Unless otherwise specified, all components described in this technical specification either:
— modify an existing interface in the C++ Standard Library in-place,
— are declared in a namespace whose name appends
::experimental::fundamentals_v3
to a namespace defined in the C++ Standard Library, such asstd
orstd::chrono
, or— are declared in a subnamespace of a namespace described in the previous bullet , whose name is not the same as an existing subnamespace of namespace
std
.[Example: This TS does not define
std::experimental::fundamentals_v3::pmr
because the C++ Standard Library definesstd::pmr
. — end example]Modify 7.2 [fund.ts.v3::func.wrap.func], class template
function
synopsis, as indicated:namespace std { namespace experimental::inline fundamentals_v3 { template<class> class function; // undefined template<class R, class... ArgTypes> class function<R(ArgTypes...)> { public: […] std::pmr::memory_resource* get_memory_resource() const noexcept; }; […] } // namespace experimental::inline fundamentals_v3 […] } // namespace stdModify [fund.ts.v3::memory.type.erased.allocator], Table 5, as indicated:
Table 5 — Computedmemory_resource
for type-erased allocator If the type ofalloc
is then the value ofrptr
is[…]
any other type meeting the requirements (C++20 ¶16.5.3.5) a pointer to a value of typeexperimental::pmr::resource_adaptor<A>
whereA
is the type ofalloc
.rptr
remains valid only for the lifetime ofX
.[…]
Modify 8.4.1 [fund.ts.v3::memory.resource.adaptor.overview] as indicated:
-1- An instance of
resource_adaptor<Allocator>
is an adaptor that wraps astd::pmr::memory_resource
interface aroundAllocator
. […]// The nameresource_adaptor_imp
is for exposition only. template<class Allocator> class resource_adaptor_imp : public std::pmr::memory_resource { public: […] virtual bool do_is_equal(const std::pmr::memory_resource& other) const noexcept; };Modify 8.4.3 [fund.ts.v3::memory.resource.adaptor.mem] as indicated:
-6- bool do_is_equal(const std::pmr::memory_resource& other) const noexcept;[…]
Modify 32.10.6 [futures.promise], class template
promise
synopsis, as indicated:namespace std { namespace experimental::inline fundamentals_v3 { template<class R> class promise { public: […] std::pmr::memory_resource* get_memory_resource() const noexcept; }; […] } // namespace experimental::inline fundamentals_v3 […] } // namespace stdModify 32.10.10 [futures.task], class template
packaged_task
synopsis, as indicated:namespace std { namespace experimental::inline fundamentals_v3 { template<class R, class... ArgTypes> class packaged_task<R(ArgTypes...)> { public: […] std::pmr::memory_resource* get_memory_resource() const noexcept; }; […] } // namespace experimental::inline fundamentals_v3 […] } // namespace std
[2022-10-12; Jonathan provides updated wording]
The LWG telecon decided on a simpler form of Option A. The changes to 4.1 [fund.ts.v3::general.namespaces] generated some questions and disagreement, but it was decided that they are not needed anyway. The normative synopses already depict the use of inline namespaces with the stated effects. That paragraph seems more informative than normative, and there were suggestions to strike it entirely. It was decided to keep it but without making the edits. As such, it remains correct for the contents of std::experimental::fundamentals_v3
. It doesn't apply to pmr::resource_adaptor
, but is not incorrect for that either. The rest of the proposed resolution fully specifies the pmr
parts.
[2022-10-19; Reflector poll]
Set status to "Tentatively Ready" after eight votes in favour in reflector poll.
[2022-11-12 Approved at November 2022 meeting in Kona. Status changed: Voting → WP.]
Proposed resolution:
This wording is relative to N4920.
Modify [fund.ts.v3::memory.type.erased.allocator], Table 5, as indicated:
Table 5 — Computedmemory_resource
for type-erased allocator If the type ofalloc
is then the value ofrptr
is[…]
any other type meeting the requirements (C++20 ¶16.5.3.5) a pointer to a value of typepmr:: experimental::resource_adaptor<A>
whereA
is the type ofalloc
.rptr
remains valid only for the lifetime ofX
.[…]
Modify 8.3 [fund.ts.v3::memory.resource.syn], header <experimental/memory_resource>
synopsis, as indicated:
namespace std::pmr::experimental::inline fundamentals_v3::pmr { […] } // namespace std::pmr::experimental::inline fundamentals_v3::pmr
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