From 6f632a376fd791bb16cc859cd4c03e111215f4c5 Mon Sep 17 00:00:00 2001 From: kmc7468 Date: Tue, 17 Mar 2020 22:40:12 +0900 Subject: [PATCH] =?UTF-8?q?Spaic=20=EB=AA=A8=EB=93=88=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/spaic/Component.hpp | 7 ++++--- include/spaic/ComponentPart.hpp | 2 +- include/spaic/detail/Component.hpp | 13 ++++++------- include/spaic/detail/ComponentPart.hpp | 2 +- include/spaic/detail/Property.hpp | 2 +- src/spaic/Component.cpp | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/spaic/Component.hpp b/include/spaic/Component.hpp index 2dc3fde..72e655a 100644 --- a/include/spaic/Component.hpp +++ b/include/spaic/Component.hpp @@ -9,6 +9,7 @@ namespace spaic::vnode { class VNode; } + namespace spaic::comp { using NativeNodeName = std::optional; @@ -19,7 +20,7 @@ class ComponentParent const NativeNodeName native_node_name; const std::vector children; - ComponentParent(NativeNodeName native_node_name, std::vector children); + ComponentParent(NativeNodeName native_node_name, std::vector &&children); }; class ComponentSingle { @@ -29,7 +30,7 @@ class ComponentSingle ComponentSingle(NativeNodeName native_node_name); template - ComponentParent operator()(T... children) noexcept; + ComponentParent operator()(T&&... children) noexcept; }; template class Component @@ -39,7 +40,7 @@ class Component Component(NativeNodeName native_node_name); template - ComponentSingle operator()(T... args) noexcept; + ComponentSingle operator()(T&&... args) noexcept; }; } // namespace spaic::comp diff --git a/include/spaic/ComponentPart.hpp b/include/spaic/ComponentPart.hpp index bc5f1b2..ebfdf33 100644 --- a/include/spaic/ComponentPart.hpp +++ b/include/spaic/ComponentPart.hpp @@ -10,7 +10,7 @@ using Update = std::function; using Render = std::function; template -Component create_component(Props props, StateSet state, Update update, Render render); +Component create_component(Props &&props, StateSet &&state, const Update &update, const Render &render); } // namespace spaic::comp #include \ No newline at end of file diff --git a/include/spaic/detail/Component.hpp b/include/spaic/detail/Component.hpp index 110f47c..41b98e2 100644 --- a/include/spaic/detail/Component.hpp +++ b/include/spaic/detail/Component.hpp @@ -9,21 +9,20 @@ namespace spaic::comp { template -ComponentParent ComponentSingle::operator()(T... children) noexcept +ComponentParent ComponentSingle::operator()(T&&... children) noexcept { // TODO: ComponentSingle::operator()(children) - return ComponentParent(this->native_node_name, {children...}); + return ComponentParent(native_node_name, { std::forward(children)... }); } template -Component::Component(NativeNodeName native_node_name) : native_node_name(native_node_name) -{ -} +Component::Component(NativeNodeName native_node_name) : native_node_name(native_node_name) {} + template template -ComponentSingle Component::operator()(T... args) noexcept +ComponentSingle Component::operator()(T&&... args) noexcept { // TODO: Component::operator()(args) - return ComponentSingle(this->native_node_name); + return ComponentSingle(native_node_name); } } // namespace spaic::comp diff --git a/include/spaic/detail/ComponentPart.hpp b/include/spaic/detail/ComponentPart.hpp index 589c465..2575f9b 100644 --- a/include/spaic/detail/ComponentPart.hpp +++ b/include/spaic/detail/ComponentPart.hpp @@ -11,7 +11,7 @@ namespace spaic::comp { template -Component create_component(Props props, StateSet state, Update update, Render render) +Component create_component(Props &&props, StateSet &&state, const Update &update, const Render &render) { // TODO: create_component(props, state, update, render) return Component(std::nullopt); diff --git a/include/spaic/detail/Property.hpp b/include/spaic/detail/Property.hpp index ffea73b..75a46dd 100644 --- a/include/spaic/detail/Property.hpp +++ b/include/spaic/detail/Property.hpp @@ -58,6 +58,6 @@ Property> optional() noexcept template Property fallback(T &&fallback_value) noexcept { - return Fallback(fallback_value); + return Fallback(std::forward(fallback_value)); } } // namespace spaic::props diff --git a/src/spaic/Component.cpp b/src/spaic/Component.cpp index 732cb96..2e6b332 100644 --- a/src/spaic/Component.cpp +++ b/src/spaic/Component.cpp @@ -5,5 +5,5 @@ namespace spaic::comp { ComponentSingle::ComponentSingle(NativeNodeName native_node_name) : native_node_name(native_node_name) {} -ComponentParent::ComponentParent(NativeNodeName native_node_name, std::vector children) : native_node_name(native_node_name), children(children) {} +ComponentParent::ComponentParent(NativeNodeName native_node_name, std::vector &&children) : native_node_name(native_node_name), children(std::move(children)) {} } // namespace spaic::comp \ No newline at end of file