From d611ca264fc1ec2f1b88e0242eaad2a3e398eeb0 Mon Sep 17 00:00:00 2001 From: Stefano Fiorentino Date: Mon, 6 Apr 2020 15:02:26 +0200 Subject: [PATCH] Instantiate Loop::run() in the .cpp This is possible because a limited values are available as Mode Signed-off-by: Stefano Fiorentino --- src/uvw/loop.cpp | 15 +++++++++++++++ src/uvw/loop.h | 6 +----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/uvw/loop.cpp b/src/uvw/loop.cpp index ff5f526a..84f4355e 100644 --- a/src/uvw/loop.cpp +++ b/src/uvw/loop.cpp @@ -65,6 +65,14 @@ UVW_INLINE void Loop::close() { } +template +bool Loop::run() noexcept { + auto utm = static_cast>(mode); + auto uvrm = static_cast(utm); + return (uv_run(loop.get(), uvrm) == 0); +} + + UVW_INLINE bool Loop::alive() const noexcept { return !(uv_loop_alive(loop.get()) == 0); } @@ -130,4 +138,11 @@ UVW_INLINE uv_loop_t *Loop::raw() noexcept { } +// explicit instantiation definitions + +template bool Loop::run() noexcept; +template bool Loop::run() noexcept; +template bool Loop::run() noexcept; + + } diff --git a/src/uvw/loop.h b/src/uvw/loop.h index 29712d12..835bcc76 100644 --- a/src/uvw/loop.h +++ b/src/uvw/loop.h @@ -264,11 +264,7 @@ public: * @return True when done, false in all other cases. */ template - bool run() noexcept { - auto utm = static_cast>(mode); - auto uvrm = static_cast(utm); - return (uv_run(loop.get(), uvrm) == 0); - } + bool run() noexcept; /** * @brief Checks if there are active resources.