From 981b03e8412cc76587c99486a04c2dbb7830cfc6 Mon Sep 17 00:00:00 2001 From: qicosmos Date: Tue, 17 Oct 2023 14:32:46 +0800 Subject: [PATCH] format --- .../thirdparty/cinatra/function_traits.hpp | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/include/ylt/thirdparty/cinatra/function_traits.hpp b/include/ylt/thirdparty/cinatra/function_traits.hpp index 3264e82a5..54cf88101 100644 --- a/include/ylt/thirdparty/cinatra/function_traits.hpp +++ b/include/ylt/thirdparty/cinatra/function_traits.hpp @@ -4,9 +4,9 @@ #include // member function -#define TIMAX_FUNCTION_TRAITS(...) \ - template \ - struct function_traits_impl \ +#define TIMAX_FUNCTION_TRAITS(...) \ + template \ + struct function_traits_impl \ : function_traits_impl {}; namespace timax { @@ -22,7 +22,8 @@ namespace timax { * 6. function with generic operator call ==> template &T::operator() */ -template struct function_traits_impl; +template +struct function_traits_impl; template struct function_traits @@ -30,14 +31,15 @@ struct function_traits template struct function_traits_impl { -public: + public: enum { arity = sizeof...(Args) }; typedef Ret function_type(Args...); typedef Ret result_type; using stl_function_type = std::function; typedef Ret (*pointer)(Args...); - template struct args { + template + struct args { static_assert(I < arity, "index is out of range, index must less than sizeof Args"); using type = typename std::tuple_element>::type; @@ -73,22 +75,22 @@ struct function_traits_impl : function_traits_impl {}; template -typename function_traits::stl_function_type -to_function(const Function &lambda) { +typename function_traits::stl_function_type to_function( + const Function &lambda) { return static_cast::stl_function_type>( lambda); } template -typename function_traits::stl_function_type -to_function(Function &&lambda) { +typename function_traits::stl_function_type to_function( + Function &&lambda) { return static_cast::stl_function_type>( std::forward(lambda)); } template -typename function_traits::pointer -to_function_pointer(const Function &lambda) { +typename function_traits::pointer to_function_pointer( + const Function &lambda) { return static_cast::pointer>(lambda); } -} // namespace timax +} // namespace timax