Re: Make copyObject work in C++

From: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: Make copyObject work in C++
Date: 2025-12-09 12:58:40
Message-ID: CAGECzQSgRGRRHt4BVhMLpxrXMGDGzFLk3d=rnC7ye2kNibc-AQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 8 Dec 2025 at 08:57, Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
> In the long run, I would like to change copyObject() to use
> typeof_unqual instead, because that handles qualifiers more correctly.
> (Currently, copyObject() of a const-qualified pointer results in a
> const-qualified pointer, which is nonsensical because the reason you
> made the copy is that you can modify it.) See attached patch for an
> example. Does C++ have something that is semantically similar to that?

Yes, there's a std::remove_cv, std::remove_const, and std::remove_volatile[1].

[1]: https://en.cppreference.com/w/cpp/types/remove_cv.html

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Anton Haglund 2025-12-09 13:04:08 [PATCH] Update comment in nodeBitmapHeapscan.c
Previous Message Bilal Yavuz 2025-12-09 12:47:13 Re: BUG #19095: Test if function exit() is used fail when linked static