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.

2361. Apply 2299 resolution throughout library

Section: 20.3.1.3 [unique.ptr.single], 20.2.3.2 [pointer.traits.types], 20.2.8.1 [allocator.uses.trait], 20.2.9.2 [allocator.traits.types], 23.2.4 [sequence.reqmts] Status: C++17 Submitter: Jonathan Wakely Opened: 2014-02-14 Last modified: 2017-07-30

Priority: Not Prioritized

View other active issues in [unique.ptr.single].

View all other issues in [unique.ptr.single].

View all issues with C++17 status.

Discussion:

LWG 2299(i) addressed a N.B. comment pointing out that recently added wording about a type existing was not clear what happens if the type exists but is inaccessible. There are 16 pre-existing uses of the same language in the library that should use the same wording used to resolve 2299.

The relevant paragraphs are:

20.3.1.3 [unique.ptr.single]

20.2.3.2 [pointer.traits.types]

20.2.8.1 [allocator.uses.trait]

20.2.9.2 [allocator.traits.types]

23.2.4 [sequence.reqmts]

[2014-05-16, Daniel provides wording]

[2014-05-18 Library reflector vote]

The issue has been identified as Tentatively Ready based on six votes in favour.

Proposed resolution:

This wording is relative to N3936.

  1. Change 20.2.3.2 [pointer.traits.types] as indicated:

    typedef see below element_type;
    

    -1- Type: Ptr::element_type if such a type existsthe qualified-id Ptr::element_type is valid and denotes a type (13.10.3 [temp.deduct]); otherwise, T if Ptr is a class template instantiation of the form SomePointer<T, Args>, where Args is zero or more type arguments; otherwise, the specialization is ill-formed.

    typedef see below difference_type;
    

    -2- Type: Ptr::difference_type if such a type existsthe qualified-id Ptr::difference_type is valid and denotes a type (13.10.3 [temp.deduct]); otherwise, std::ptrdiff_t.

    template <class U> using rebind = see below;
    

    -3- Alias template: Ptr::rebind<U> if such a type existsthe qualified-id Ptr::rebind<U> is valid and denotes a type (13.10.3 [temp.deduct]); otherwise, SomePointer<U, Args> if Ptr is a class template instantiation of the form SomePointer<T, Args>, where Args is zero or more type arguments; otherwise, the instantiation of rebind is ill-formed.

  2. Change 20.2.8.1 [allocator.uses.trait] p1 as indicated:

    template <class T, class Alloc> struct uses_allocator;
    

    -1- Remarks: automatically detects whether T has a nested allocator_type that is convertible from Alloc. Meets the BinaryTypeTrait requirements (20.10.1). The implementation shall provide a definition that is derived from true_type if a typethe qualified-id T::allocator_type existsis valid and denotes a type (13.10.3 [temp.deduct]) and is_convertible<Alloc, T::allocator_type>::value != false, otherwise it shall be derived from false_type. […]

  3. Change 20.2.9.2 [allocator.traits.types] as indicated:

    typedef see below pointer;
    

    -1- Type: Alloc::pointer if such a type existsthe qualified-id Alloc::pointer is valid and denotes a type (13.10.3 [temp.deduct]); otherwise, value_type*.

    typedef see below const_pointer;
    

    -2- Type: Alloc::const_pointer if such a type existsthe qualified-id Alloc::const_pointer is valid and denotes a type (13.10.3 [temp.deduct]); otherwise, pointer_traits<pointer>::rebind<const value_type>.

    typedef see below void_pointer;
    

    -3- Type: Alloc::void_pointer if such a type existsthe qualified-id Alloc::void_pointer is valid and denotes a type (13.10.3 [temp.deduct]); otherwise, pointer_traits<pointer>::rebind<void>.

    typedef see below const_void_pointer;
    

    -4- Type: Alloc::const_void_pointer if such a type existsthe qualified-id Alloc::const_void_pointer is valid and denotes a type (13.10.3 [temp.deduct]); otherwise, pointer_traits<pointer>::rebind<const void>.

    typedef see below difference_type;
    

    -5- Type: Alloc::difference_type if such a type existsthe qualified-id Alloc::difference_type is valid and denotes a type (13.10.3 [temp.deduct]); otherwise, pointer_traits<pointer>::difference_type.

    typedef see below size_type;
    

    -6- Type: Alloc::size_type if such a type existsthe qualified-id Alloc::size_type is valid and denotes a type (13.10.3 [temp.deduct]); otherwise, make_unsigned_t<difference_type>.

    typedef see below propagate_on_container_copy_assignment;
    

    -7- Type: Alloc::propagate_on_container_copy_assignment if such a type existsthe qualified-id Alloc::propagate_on_container_copy_assignment is valid and denotes a type (13.10.3 [temp.deduct]); otherwise, false_type.

    typedef see below propagate_on_container_move_assignment;
    

    -8- Type: Alloc::propagate_on_container_move_assignment if such a type existsthe qualified-id Alloc::propagate_on_container_move_assignment is valid and denotes a type (13.10.3 [temp.deduct]); otherwise, false_type.

    typedef see below propagate_on_container_swap;
    

    -9- Type: Alloc::propagate_on_container_swap if such a type existsthe qualified-id Alloc::propagate_on_container_swap is valid and denotes a type (13.10.3 [temp.deduct]); otherwise, false_type.

    template <class T> using rebind_alloc = see below;
    

    -10- Alias template: Alloc::rebind<T>::other if such a type existsthe qualified-id Alloc::rebind<T>::other is valid and denotes a type (13.10.3 [temp.deduct]); otherwise, Alloc<T, Args> if Alloc is a class template instantiation of the form Alloc<U, Args>, where Args is zero or more type arguments; otherwise, the instantiation of rebind_alloc is ill-formed.

  4. Change 20.3.1.3 [unique.ptr.single] p3 as indicated:

    -3- If the typequalified-id remove_reference_t<D>::pointer existsis valid and denotes a type (13.10.3 [temp.deduct]), then unique_ptr<T, D>::pointer shall be a synonym for remove_reference_t<D>::pointer. […]

  5. Change 23.2.4 [sequence.reqmts] p3 as indicated:

    -3- In Tables 100 and 101, X denotes a sequence container class, a denotes a value of X containing elements of type T, A denotes X::allocator_type if it existsthe qualified-id X::allocator_type is valid and denotes a type (13.10.3 [temp.deduct]) and std::allocator<T> if it doesn't, […]