From 7ffa6bf99972a980d995081a66b858eaaca9db7e Mon Sep 17 00:00:00 2001 From: Regina Pfeifer Date: Wed, 12 Dec 2018 15:33:17 +0100 Subject: cmUVHandlePtr: Use inherited constructors --- Source/cmUVHandlePtr.h | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/Source/cmUVHandlePtr.h b/Source/cmUVHandlePtr.h index 2937e0d..73ee334 100644 --- a/Source/cmUVHandlePtr.h +++ b/Source/cmUVHandlePtr.h @@ -3,7 +3,6 @@ #pragma once #include "cmConfigure.h" // IWYU pragma: keep -#include #include #include #include @@ -11,12 +10,22 @@ #include "cm_uv.h" -#define CM_PERFECT_FWD_CTOR(Class, FwdTo) \ - template \ - Class(Args&&... args) \ - : FwdTo(std::forward(args)...) \ - { \ - } +#if defined(__SUNPRO_CC) + +# include + +# define CM_INHERIT_CTOR(Class, Base, Tpl) \ + template \ + Class(Args&&... args) \ + : Base Tpl(std::forward(args)...) \ + { \ + } + +#else + +# define CM_INHERIT_CTOR(Class, Base, Tpl) using Base Tpl ::Base; + +#endif namespace cm { @@ -116,7 +125,7 @@ class uv_handle_ptr_ : public uv_handle_ptr_base_ friend class uv_handle_ptr_; public: - CM_PERFECT_FWD_CTOR(uv_handle_ptr_, uv_handle_ptr_base_); + CM_INHERIT_CTOR(uv_handle_ptr_, uv_handle_ptr_base_, ); /*** * Allow less verbose calling of uv_ functions @@ -133,13 +142,13 @@ template <> class uv_handle_ptr_ : public uv_handle_ptr_base_ { public: - CM_PERFECT_FWD_CTOR(uv_handle_ptr_, uv_handle_ptr_base_); + CM_INHERIT_CTOR(uv_handle_ptr_, uv_handle_ptr_base_, ); }; class uv_async_ptr : public uv_handle_ptr_ { public: - CM_PERFECT_FWD_CTOR(uv_async_ptr, uv_handle_ptr_); + CM_INHERIT_CTOR(uv_async_ptr, uv_handle_ptr_, ); int init(uv_loop_t& loop, uv_async_cb async_cb, void* data = nullptr); @@ -148,7 +157,7 @@ public: struct uv_signal_ptr : public uv_handle_ptr_ { - CM_PERFECT_FWD_CTOR(uv_signal_ptr, uv_handle_ptr_); + CM_INHERIT_CTOR(uv_signal_ptr, uv_handle_ptr_, ); int init(uv_loop_t& loop, void* data = nullptr); @@ -159,7 +168,7 @@ struct uv_signal_ptr : public uv_handle_ptr_ struct uv_pipe_ptr : public uv_handle_ptr_ { - CM_PERFECT_FWD_CTOR(uv_pipe_ptr, uv_handle_ptr_); + CM_INHERIT_CTOR(uv_pipe_ptr, uv_handle_ptr_, ); operator uv_stream_t*() const; @@ -168,7 +177,7 @@ struct uv_pipe_ptr : public uv_handle_ptr_ struct uv_process_ptr : public uv_handle_ptr_ { - CM_PERFECT_FWD_CTOR(uv_process_ptr, uv_handle_ptr_); + CM_INHERIT_CTOR(uv_process_ptr, uv_handle_ptr_, ); int spawn(uv_loop_t& loop, uv_process_options_t const& options, void* data = nullptr); @@ -176,7 +185,7 @@ struct uv_process_ptr : public uv_handle_ptr_ struct uv_timer_ptr : public uv_handle_ptr_ { - CM_PERFECT_FWD_CTOR(uv_timer_ptr, uv_handle_ptr_); + CM_INHERIT_CTOR(uv_timer_ptr, uv_handle_ptr_, ); int init(uv_loop_t& loop, void* data = nullptr); @@ -185,7 +194,7 @@ struct uv_timer_ptr : public uv_handle_ptr_ struct uv_tty_ptr : public uv_handle_ptr_ { - CM_PERFECT_FWD_CTOR(uv_tty_ptr, uv_handle_ptr_); + CM_INHERIT_CTOR(uv_tty_ptr, uv_handle_ptr_, ); operator uv_stream_t*() const; -- cgit v0.12