[PATCH 1/3] Introduce gdb::unique_ptr

Simon Marchi simon.marchi@polymtl.ca
Mon Oct 10 17:49:00 GMT 2016


This is clearly way above my C++ skill level, I feel like I'm reading 
boost code.  But since it's well encapsulated in a "support" file and 
mimics the standard behaviors, I think it's good.  I just hope the whole 
codebase won't end up lookup like this :).

On 2016-10-10 12:46, Pedro Alves wrote:
>  - support for all of 'ptr != NULL', 'ptr == NULL' and 'if (ptr)'
>    using the safe bool idiom.

Since our coding style doesn't allow the "if (ptr)" form, is it possible
to make it cause a compile error?

> +/* Base class of our unique_ptr emulation.  Contains code common to
> +   both the unique_ptr<T, D> and unique_ptr<T[], D>.  */
> +
> +template<typename T, typename D>
> +class unique_ptr_base : public safe_bool <unique_ptr_base<T, D> >
> +{
> +public:
> +  typedef T *pointer;

pointer_type?



More information about the Gdb-patches mailing list