[libcalamares] Switch to std::vector
Keeping std::initializer_list around is fraught. Causes segfaults because I'm not keeping the underlying temporary array around properly. Switch to vectors because those initialize from the underlying array. TODO: look into making this sufficiently constexpr -- perhaps just use std::array and make find() work on that.
This commit is contained in:
parent
097927eb3e
commit
79cee26b33
@ -40,7 +40,7 @@ struct NamedEnumTable
|
|||||||
using string_t = QString;
|
using string_t = QString;
|
||||||
using enum_t = T;
|
using enum_t = T;
|
||||||
using pair_t = std::pair< string_t, enum_t >;
|
using pair_t = std::pair< string_t, enum_t >;
|
||||||
using type = std::initializer_list< pair_t >;
|
using type = std::vector< pair_t >;
|
||||||
|
|
||||||
type table;
|
type table;
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ struct NamedEnumTable
|
|||||||
*
|
*
|
||||||
* static const NamedEnumTable<Colors> c{ {"red", Colors::Red } };
|
* static const NamedEnumTable<Colors> c{ {"red", Colors::Red } };
|
||||||
*/
|
*/
|
||||||
NamedEnumTable( type v ) : table( v ) { /* static_assert( v.size() > 0 ); */ };
|
NamedEnumTable( const std::initializer_list< pair_t >& v ) : table( v ) { /* static_assert( v.size() > 0 ); */ };
|
||||||
|
|
||||||
/** @brief Find a name @p s in the table.
|
/** @brief Find a name @p s in the table.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user