From 27bf11d35c8ce44fd9fef656e2975712846b9bb2 Mon Sep 17 00:00:00 2001 From: Antony Woods Date: Thu, 23 Oct 2014 18:33:03 +0100 Subject: Re-implemented 'get_middleware()' as suggested, without changing the Server constructor and now no longer encountering hangs --- include/utility.h | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'include/utility.h') diff --git a/include/utility.h b/include/utility.h index c910eb2..835fdbd 100644 --- a/include/utility.h +++ b/include/utility.h @@ -293,5 +293,45 @@ template struct empty_context { }; - } + + } // namespace black_magic + + namespace detail + { + + template + struct get_index_of_element_from_tuple_by_type_impl + { + static constexpr auto value = N; + }; + + template + struct get_index_of_element_from_tuple_by_type_impl + { + static constexpr auto value = N; + }; + + template + struct get_index_of_element_from_tuple_by_type_impl + { + static constexpr auto value = get_index_of_element_from_tuple_by_type_impl::value; + }; + + } // namespace detail + + namespace utility + { + template + T get_element_by_type(std::tuple& t) + { + return std::get::value>(t); + } + + template + T* get_element_by_type_ptr(std::tuple& t) + { + return &std::get::value>(t); + } + + } // namespace utility } -- cgit v1.2.3-54-g00ecf