serge-sans-paille / frozen

a header-only, constexpr alternative to gperf for C++14 users
Apache License 2.0
1.31k stars 104 forks source link

implicit size like std::to_array #174

Closed gvollant closed 4 months ago

gvollant commented 4 months ago

hello, c++20 std::to_array ( https://en.cppreference.com/w/cpp/container/array/to_array ) don't need explicit size

example :

    constexpr auto a4 = std::to_array<std::pair<int, float>>(
        {{3, 0.0f}, {4, 0.1f}, {4, 0.1e23f}});

When I used frozen, I had to manualy count the number of items. Is it possible to do automatic count?

gvollant commented 4 months ago

the solution is make_unordered_set

static constexpr auto export_frozen = frozen::make_unordered_set<frozen::string>({  "date_min"sv, "zz","aa","date_max"sv,  "record"sv } );