From 946292747e867ffcac6eda301529a4e49b67a9c9 Mon Sep 17 00:00:00 2001 From: Vladislav Oleshko Date: Mon, 23 May 2022 20:17:49 +0300 Subject: [PATCH] Small fixes --- include/crow/utility.h | 32 ++++++++++++++++---------------- tests/unittest.cpp | 6 ++++-- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/include/crow/utility.h b/include/crow/utility.h index a20990a55..98206384e 100644 --- a/include/crow/utility.h +++ b/include/crow/utility.h @@ -265,6 +265,22 @@ namespace crow struct has_type> : std::true_type {}; + // Find index of type in tuple + template + struct tuple_index; + + template + struct tuple_index> + { + static const int value = 0; + }; + + template + struct tuple_index> + { + static const int value = 1 + tuple_index>::value; + }; + // Extract element from forward tuple or get default #ifdef CROW_CAN_USE_CPP14 template @@ -288,22 +304,6 @@ namespace crow { return T{}; } - - // Find index of type in tuple - template - struct tuple_index; - - template - struct tuple_index> - { - static const int value = 0; - }; - - template - struct tuple_index> - { - static const int value = 1 + tuple_index>::value; - }; // Kind of fold expressions in C++11 template diff --git a/tests/unittest.cpp b/tests/unittest.cpp index c4b916304..568a30e1a 100644 --- a/tests/unittest.cpp +++ b/tests/unittest.cpp @@ -1523,8 +1523,10 @@ struct OnlyMoveConstructor TEST_CASE("app_constructor") { - App - app(OnlyMoveConstructor(1), SecondMW{}); + App, SecondMW> + app1(OnlyMoveConstructor(1), SecondMW{}); + App, SecondMW> + app2(FirstMW{}, OnlyMoveConstructor(1)); } // app_constructor TEST_CASE("middleware_blueprint")