jiridanek commented on a change in pull request #315:
URL: https://github.com/apache/qpid-proton/pull/315#discussion_r639137399
##########
File path: c/tests/pn_test.hpp
##########
@@ -46,13 +46,14 @@ namespace pn_test {
template <class T, void (*Free)(T *)> class auto_free {
T *ptr_;
auto_free &operator=(auto_free &x);
- auto_free(auto_free &x);
+public:
+ auto_free(auto_free &x) = delete;
public:
- auto_free(T *p = 0) : ptr_(p) {}
+ explicit auto_free(T *p = 0) : ptr_(p) {}
~auto_free() { Free(ptr_); }
T *get() const { return ptr_; }
- operator T *() const { return ptr_; }
+ operator T *() const { return ptr_; } // not marking explicit for convenience
Review comment:
This class is something like an `std::unique_ptr` with a deleter.
Apparently having explicit `operator*` was considered and dismissed, for
reasons
https://herbsutter.com/2012/06/21/reader-qa-why-dont-modern-smart-pointers-implicitly-convert-to/
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]