From 08b8027d0fde2339dbe48f53f3a9bc3bd9ba3915 Mon Sep 17 00:00:00 2001 From: Pavel Medvedev Date: Sun, 21 Jul 2019 22:05:00 +0200 Subject: [PATCH] removed unused `call_from_v8_traits::arg_convert` ...using it only in test_call_from_v8.cpp Refine in context of #113 --- test/test_call_from_v8.cpp | 52 ++++++++++++++++++++------------------ v8pp/call_from_v8.hpp | 5 +--- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/test/test_call_from_v8.cpp b/test/test_call_from_v8.cpp index 8ed140dc..ce9c672b 100644 --- a/test/test_call_from_v8.cpp +++ b/test/test_call_from_v8.cpp @@ -41,48 +41,52 @@ using v8pp::detail::call_from_v8_traits; using v8pp::raw_ptr_traits; using v8pp::shared_ptr_traits; +template +using arg_convert = typename call_from_v8_traits::template arg_converter< + typename call_from_v8_traits::template arg_type, Traits>; + // fundamental type converters -static_assert(std::is_same::arg_convert<0, raw_ptr_traits>, v8pp::convert>::value, "y(int)"); -static_assert(std::is_same::arg_convert<0, shared_ptr_traits>, v8pp::convert>::value, "y(int)"); +static_assert(std::is_same, v8pp::convert>::value, "y(int)"); +static_assert(std::is_same, v8pp::convert>::value, "y(int)"); -static_assert(std::is_same::arg_convert<1, raw_ptr_traits>, v8pp::convert>::value, "y(int)"); -static_assert(std::is_same::arg_convert<1, shared_ptr_traits>, v8pp::convert>::value, "y(int)"); +static_assert(std::is_same, v8pp::convert>::value, "y(int)"); +static_assert(std::is_same, v8pp::convert>::value, "y(int)"); // cv arg converters static void s(std::string, std::vector&, std::shared_ptr const&, std::string*, std::string const*) {} -static_assert(std::is_same::arg_convert<0, raw_ptr_traits>, v8pp::convert>::value, "s(string)"); -static_assert(std::is_same::arg_convert<0, shared_ptr_traits>, v8pp::convert>::value, "s(string)"); +static_assert(std::is_same, v8pp::convert>::value, "s(string)"); +static_assert(std::is_same, v8pp::convert>::value, "s(string)"); -static_assert(std::is_same::arg_convert<1, raw_ptr_traits>, v8pp::convert>>::value, "s(vector&)"); -static_assert(std::is_same::arg_convert<1, shared_ptr_traits>, v8pp::convert>>::value, "s(vector&)"); +static_assert(std::is_same, v8pp::convert>>::value, "s(vector&)"); +static_assert(std::is_same, v8pp::convert>>::value, "s(vector&)"); -static_assert(std::is_same::arg_convert<2, raw_ptr_traits>, v8pp::convert>>::value, "s(std::shared_ptr const&)"); -static_assert(std::is_same::arg_convert<2, shared_ptr_traits>, v8pp::convert>>::value, "s(std::shared_ptr const&)"); +static_assert(std::is_same, v8pp::convert>>::value, "s(std::shared_ptr const&)"); +static_assert(std::is_same, v8pp::convert>>::value, "s(std::shared_ptr const&)"); -static_assert(std::is_same::arg_convert<3, raw_ptr_traits>, v8pp::convert>::value, "s(std::string*)"); -static_assert(std::is_same::arg_convert<3, shared_ptr_traits>, v8pp::convert>::value, "s(std::string*)"); +static_assert(std::is_same, v8pp::convert>::value, "s(std::string*)"); +static_assert(std::is_same, v8pp::convert>::value, "s(std::string*)"); -static_assert(std::is_same::arg_convert<4, raw_ptr_traits>, v8pp::convert>::value, "s(std::string const*)"); -static_assert(std::is_same::arg_convert<4, shared_ptr_traits>, v8pp::convert>::value, "s(std::string const*)"); +static_assert(std::is_same, v8pp::convert>::value, "s(std::string const*)"); +static_assert(std::is_same, v8pp::convert>::value, "s(std::string const*)"); // fundamental types cv arg converters static void t(int, char&, bool const&, float*, char const*) {} -static_assert(std::is_same::arg_convert<0, raw_ptr_traits>, v8pp::convert>::value, "t(int)"); -static_assert(std::is_same::arg_convert<0, shared_ptr_traits>, v8pp::convert>::value, "t(int)"); +static_assert(std::is_same, v8pp::convert>::value, "t(int)"); +static_assert(std::is_same, v8pp::convert>::value, "t(int)"); -static_assert(std::is_same::arg_convert<1, raw_ptr_traits>, v8pp::convert>::value, "t(char&)"); -static_assert(std::is_same::arg_convert<1, shared_ptr_traits>, v8pp::convert>::value, "t(char&)"); +static_assert(std::is_same, v8pp::convert>::value, "t(char&)"); +static_assert(std::is_same, v8pp::convert>::value, "t(char&)"); -static_assert(std::is_same::arg_convert<2, raw_ptr_traits>, v8pp::convert>::value, "t(bool const&)"); -static_assert(std::is_same::arg_convert<2, shared_ptr_traits>, v8pp::convert>::value, "t(bool const&)"); +static_assert(std::is_same, v8pp::convert>::value, "t(bool const&)"); +static_assert(std::is_same, v8pp::convert>::value, "t(bool const&)"); -static_assert(std::is_same::arg_convert<3, raw_ptr_traits>, v8pp::convert>::value, "t(float*)"); -static_assert(std::is_same::arg_convert<3, shared_ptr_traits>, v8pp::convert>::value, "t(float*)"); +static_assert(std::is_same, v8pp::convert>::value, "t(float*)"); +static_assert(std::is_same, v8pp::convert>::value, "t(float*)"); -static_assert(std::is_same::arg_convert<4, raw_ptr_traits>, v8pp::convert>::value, "t(char const*)"); -static_assert(std::is_same::arg_convert<4, shared_ptr_traits>, v8pp::convert>::value, "t(char const*)"); +static_assert(std::is_same, v8pp::convert>::value, "t(char const*)"); +static_assert(std::is_same, v8pp::convert>::value, "t(char const*)"); void test_call_from_v8() { diff --git a/v8pp/call_from_v8.hpp b/v8pp/call_from_v8.hpp index 3227027e..57d501c1 100644 --- a/v8pp/call_from_v8.hpp +++ b/v8pp/call_from_v8.hpp @@ -57,14 +57,11 @@ struct call_from_v8_traits convert> >; - template - using arg_convert = arg_converter, Traits>; - template static decltype(auto) arg_from_v8(v8::FunctionCallbackInfo const& args) { // might be reference - return (arg_convert::from_v8(args.GetIsolate(), args[Index - offset])); + return (arg_converter, Traits>::from_v8(args.GetIsolate(), args[Index - offset])); } };