summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRegina Pfeifer <regina@mailbox.org>2018-12-12 14:33:17 (GMT)
committerRegina Pfeifer <regina@mailbox.org>2018-12-15 09:23:23 (GMT)
commit7ffa6bf99972a980d995081a66b858eaaca9db7e (patch)
tree92c363865e08f0796f8c5e97052424b5f793c655
parentb95b935ccfddb9888802a9fe46a210002fa0e229 (diff)
downloadCMake-7ffa6bf99972a980d995081a66b858eaaca9db7e.zip
CMake-7ffa6bf99972a980d995081a66b858eaaca9db7e.tar.gz
CMake-7ffa6bf99972a980d995081a66b858eaaca9db7e.tar.bz2
cmUVHandlePtr: Use inherited constructors
-rw-r--r--Source/cmUVHandlePtr.h39
1 files 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 <algorithm>
#include <cstddef>
#include <cstdint>
#include <memory>
@@ -11,12 +10,22 @@
#include "cm_uv.h"
-#define CM_PERFECT_FWD_CTOR(Class, FwdTo) \
- template <typename... Args> \
- Class(Args&&... args) \
- : FwdTo(std::forward<Args>(args)...) \
- { \
- }
+#if defined(__SUNPRO_CC)
+
+# include <utility>
+
+# define CM_INHERIT_CTOR(Class, Base, Tpl) \
+ template <typename... Args> \
+ Class(Args&&... args) \
+ : Base Tpl(std::forward<Args>(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_<T>
friend class uv_handle_ptr_;
public:
- CM_PERFECT_FWD_CTOR(uv_handle_ptr_, uv_handle_ptr_base_<T>);
+ CM_INHERIT_CTOR(uv_handle_ptr_, uv_handle_ptr_base_, <T>);
/***
* Allow less verbose calling of uv_<T> functions
@@ -133,13 +142,13 @@ template <>
class uv_handle_ptr_<uv_handle_t> : public uv_handle_ptr_base_<uv_handle_t>
{
public:
- CM_PERFECT_FWD_CTOR(uv_handle_ptr_, uv_handle_ptr_base_<uv_handle_t>);
+ CM_INHERIT_CTOR(uv_handle_ptr_, uv_handle_ptr_base_, <uv_handle_t>);
};
class uv_async_ptr : public uv_handle_ptr_<uv_async_t>
{
public:
- CM_PERFECT_FWD_CTOR(uv_async_ptr, uv_handle_ptr_<uv_async_t>);
+ CM_INHERIT_CTOR(uv_async_ptr, uv_handle_ptr_, <uv_async_t>);
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_<uv_signal_t>
{
- CM_PERFECT_FWD_CTOR(uv_signal_ptr, uv_handle_ptr_<uv_signal_t>);
+ CM_INHERIT_CTOR(uv_signal_ptr, uv_handle_ptr_, <uv_signal_t>);
int init(uv_loop_t& loop, void* data = nullptr);
@@ -159,7 +168,7 @@ struct uv_signal_ptr : public uv_handle_ptr_<uv_signal_t>
struct uv_pipe_ptr : public uv_handle_ptr_<uv_pipe_t>
{
- CM_PERFECT_FWD_CTOR(uv_pipe_ptr, uv_handle_ptr_<uv_pipe_t>);
+ CM_INHERIT_CTOR(uv_pipe_ptr, uv_handle_ptr_, <uv_pipe_t>);
operator uv_stream_t*() const;
@@ -168,7 +177,7 @@ struct uv_pipe_ptr : public uv_handle_ptr_<uv_pipe_t>
struct uv_process_ptr : public uv_handle_ptr_<uv_process_t>
{
- CM_PERFECT_FWD_CTOR(uv_process_ptr, uv_handle_ptr_<uv_process_t>);
+ CM_INHERIT_CTOR(uv_process_ptr, uv_handle_ptr_, <uv_process_t>);
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_<uv_process_t>
struct uv_timer_ptr : public uv_handle_ptr_<uv_timer_t>
{
- CM_PERFECT_FWD_CTOR(uv_timer_ptr, uv_handle_ptr_<uv_timer_t>);
+ CM_INHERIT_CTOR(uv_timer_ptr, uv_handle_ptr_, <uv_timer_t>);
int init(uv_loop_t& loop, void* data = nullptr);
@@ -185,7 +194,7 @@ struct uv_timer_ptr : public uv_handle_ptr_<uv_timer_t>
struct uv_tty_ptr : public uv_handle_ptr_<uv_tty_t>
{
- CM_PERFECT_FWD_CTOR(uv_tty_ptr, uv_handle_ptr_<uv_tty_t>);
+ CM_INHERIT_CTOR(uv_tty_ptr, uv_handle_ptr_, <uv_tty_t>);
operator uv_stream_t*() const;