mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
Small fixes
This commit is contained in:
parent
94fa9f77f6
commit
946292747e
@ -265,6 +265,22 @@ namespace crow
|
||||
struct has_type<T, std::tuple<T, Ts...>> : std::true_type
|
||||
{};
|
||||
|
||||
// Find index of type in tuple
|
||||
template<class T, class Tuple>
|
||||
struct tuple_index;
|
||||
|
||||
template<class T, class... Types>
|
||||
struct tuple_index<T, std::tuple<T, Types...>>
|
||||
{
|
||||
static const int value = 0;
|
||||
};
|
||||
|
||||
template<class T, class U, class... Types>
|
||||
struct tuple_index<T, std::tuple<U, Types...>>
|
||||
{
|
||||
static const int value = 1 + tuple_index<T, std::tuple<Types...>>::value;
|
||||
};
|
||||
|
||||
// Extract element from forward tuple or get default
|
||||
#ifdef CROW_CAN_USE_CPP14
|
||||
template<typename T, typename Tup>
|
||||
@ -288,22 +304,6 @@ namespace crow
|
||||
{
|
||||
return T{};
|
||||
}
|
||||
|
||||
// Find index of type in tuple
|
||||
template<class T, class Tuple>
|
||||
struct tuple_index;
|
||||
|
||||
template<class T, class... Types>
|
||||
struct tuple_index<T, std::tuple<T, Types...>>
|
||||
{
|
||||
static const int value = 0;
|
||||
};
|
||||
|
||||
template<class T, class U, class... Types>
|
||||
struct tuple_index<T, std::tuple<U, Types...>>
|
||||
{
|
||||
static const int value = 1 + tuple_index<T, std::tuple<Types...>>::value;
|
||||
};
|
||||
|
||||
// Kind of fold expressions in C++11
|
||||
template<bool...>
|
||||
|
@ -1523,8 +1523,10 @@ struct OnlyMoveConstructor
|
||||
|
||||
TEST_CASE("app_constructor")
|
||||
{
|
||||
App<NullMiddleware, OnlyMoveConstructor, FirstMW, SecondMW>
|
||||
app(OnlyMoveConstructor(1), SecondMW{});
|
||||
App<NullMiddleware, OnlyMoveConstructor, FirstMW<false>, SecondMW<false>>
|
||||
app1(OnlyMoveConstructor(1), SecondMW<false>{});
|
||||
App<NullMiddleware, OnlyMoveConstructor, FirstMW<false>, SecondMW<false>>
|
||||
app2(FirstMW<false>{}, OnlyMoveConstructor(1));
|
||||
} // app_constructor
|
||||
|
||||
TEST_CASE("middleware_blueprint")
|
||||
|
Loading…
Reference in New Issue
Block a user