mirror of
https://github.com/matrix-construct/construct
synced 2025-03-17 06:50:23 +01:00
ircd::json::tuple: Modernize constant evaluation selection list constructions.
This commit is contained in:
parent
527af013f7
commit
96119166fa
1 changed files with 11 additions and 8 deletions
|
@ -60,17 +60,18 @@ template<class T>
|
|||
struct ircd::json::keys<T>::include
|
||||
:selection
|
||||
{
|
||||
constexpr include(const vector_view<const string_view> list)
|
||||
include(const vector_view<const string_view> &keys)
|
||||
:selection{0}
|
||||
{
|
||||
for(const auto key : list)
|
||||
for(const auto &key : keys)
|
||||
selection::set(key, true);
|
||||
}
|
||||
|
||||
constexpr include(const std::initializer_list<const string_view> list)
|
||||
template<class... list>
|
||||
consteval include(list&&... keys)
|
||||
:selection{0}
|
||||
{
|
||||
for(const auto key : list)
|
||||
for(auto&& key : {keys...})
|
||||
selection::set(key, true);
|
||||
}
|
||||
|
||||
|
@ -86,17 +87,19 @@ template<class T>
|
|||
struct ircd::json::keys<T>::exclude
|
||||
:selection
|
||||
{
|
||||
constexpr exclude(const vector_view<const string_view> list)
|
||||
exclude(const vector_view<const string_view> &keys)
|
||||
:selection{}
|
||||
{
|
||||
for(const auto key : list)
|
||||
for(const auto &key : keys)
|
||||
selection::set(key, false);
|
||||
}
|
||||
|
||||
constexpr exclude(const std::initializer_list<const string_view> list)
|
||||
|
||||
template<class... list>
|
||||
consteval exclude(list&&... keys)
|
||||
:selection{}
|
||||
{
|
||||
for(const auto key : list)
|
||||
for(auto&& key : {keys...})
|
||||
selection::set(key, false);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue