28 #ifndef NANO_RUNTIME_CONVERTER_HPP
29 #define NANO_RUNTIME_CONVERTER_HPP
35 #include <type_traits>
48 template <
typename Element>
51 using type =
typename Element::type;
53 static constexpr
type result() {
return Element::value; };
57 template <
typename First,
typename... Rest>
60 static constexpr std::size_t size =
sizeof...(Rest) + 1;
62 using type =
typename std::array<typename First::type, size>;
65 return type{ {First::value, Rest::value...} };
74 template <
typename Element>
77 using type =
typename Element::type;
79 static constexpr
type result() {
return Element::value; };
83 template <
typename First,
typename... Rest>
86 using type =
typename std::vector<typename First::type>;
89 return type{ {First::value, Rest::value...} };
99 template <
typename List>
103 template <
typename Head,
typename... Tail>
107 static constexpr std::size_t num_elements =
sizeof...(Tail) + 1;
110 using array_type =
typename std::array<array_internal_type, num_elements>;
140 #endif // NANO_RUNTIME_VECTOR_HPP
static constexpr type result()
Definition: runtime_converter.hpp:88
Header file for the list metaclass to provide compile time lists.
static constexpr type result()
Definition: runtime_converter.hpp:79
static constexpr array_type to_array()
Converts a nano::list to a std::array, if the nano::list just contains elements. If the nano::list co...
Definition: runtime_converter.hpp:118
Wrapper class to provide the conversion functions for converting to runtime containers.
Definition: runtime_converter.hpp:100
static constexpr type result()
Definition: runtime_converter.hpp:53
Definition: containers.hpp:34
static constexpr vector_type to_vector()
Converts a nano::list to a std::vector, if the nano::list just contains elements. If the nano::list c...
Definition: runtime_converter.hpp:132
Same as convert, but uses vector's instead of arrays, so the performance is worse.
Definition: runtime_converter.hpp:75
typename std::array< typename First::type, size > type
Definition: runtime_converter.hpp:62
typename detail::vector_convert< Head >::type vector_internal_type
Definition: runtime_converter.hpp:123
typename Element::type type
Definition: runtime_converter.hpp:77
typename std::vector< vector_internal_type > vector_type
Definition: runtime_converter.hpp:124
Converts an element to a std type, like nano::int_t to inr or a nano::list into a std::array with N e...
Definition: runtime_converter.hpp:49
Meta class that holds types, and allows functions to be applied to the elements of the list using the...
Definition: list.hpp:51
typename detail::array_convert< Head >::type array_internal_type
Definition: runtime_converter.hpp:109
typename std::array< array_internal_type, num_elements > array_type
Definition: runtime_converter.hpp:110
static constexpr type result()
Definition: runtime_converter.hpp:64
typename std::vector< typename First::type > type
Definition: runtime_converter.hpp:86
typename Element::type type
Definition: runtime_converter.hpp:51