Title
monotonic_memory_resource::do_is_equal uses dynamic_cast unnecessarily
Status
c++20
Section
[mem.res.monotonic.buffer.mem]
Submitter
Pablo Halpern

Created on 2017-07-14.00:00:00 last changed 40 months ago

Messages

Date: 2018-03-18.16:03:30

Proposed resolution:

This resolution is relative to N4687.

  1. Edit [mem.res.pool.mem] as indicated:

    bool synchronized_pool_resource::do_is_equal(const memory_resource& other) const noexcept override;
        const memory_resource& other) const noexcept override;
    

    Returns: this == dynamic_cast<const synchronized_pool_resource*>(&other).

  2. Strike [mem.res.pool.mem] paragraph 10, and the immediately preceding declaration of unsynchronized_pool_resource::do_is_equal.

  3. Edit [mem.res.monotonic.buffer.mem] as indicated:

    bool do_is_equal(const memory_resource& other) const noexcept override;
    

    Returns: this == dynamic_cast<const monotonic_buffer_resource*>(&other).

Date: 2018-03-17.00:00:00

[ 2018-3-17 Adopted in Jacksonville ]

Date: 2017-11-01.00:00:00

[ 2017-11-01 Moved to Tentatively Ready after 7 positive votes for P0 on c++std-lib. ]

Date: 2017-09-15.00:00:00

[ 2017-09-18, Casey Carter expands PR to cover the pool resources. ]

Previous resolution: [SUPERSEDED]
  1. Edit [mem.res.monotonic.buffer.mem] as indicated:

    bool do_is_equal(const memory_resource& other) const noexcept override;
    

    Returns: this == dynamic_cast<const monotonic_buffer_resource*>(&other).

Date: 2017-07-15.00:00:00

[ 2017-07-16, Tim Song comments ]

The pool resource classes appear to also have this issue.

Date: 2017-07-14.00:00:00

Section [mem.res.monotonic.buffer.mem], paragraph 11 says

bool do_is_equal(const memory_resource& other) const noexcept override;

Returns: this == dynamic_cast<const monotonic_buffer_resource*>(&other).

The dynamic_cast adds nothing of value. It is an incorrect cut-and-paste from an example do_is_equal for a more complex resource.

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2018-03-18 16:03:30adminsetmessages: + msg9733
2018-03-18 16:03:30adminsetstatus: voting -> wp
2018-02-12 01:13:49adminsetstatus: ready -> voting
2017-11-01 18:57:15adminsetmessages: + msg9495
2017-11-01 18:57:15adminsetstatus: new -> ready
2017-09-18 19:34:11adminsetmessages: + msg9463
2017-07-16 16:00:36adminsetmessages: + msg9413
2017-07-16 13:01:03adminsetmessages: + msg9406
2017-07-14 00:00:00admincreate