This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/3] Introduce gdb::unique_ptr


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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]