feat(templates): add specialization of GetData and GetNum to initializer_list
This commit is contained in:
parent
246965af79
commit
c4c1430e46
@ -23,6 +23,12 @@ constexpr decltype(auto) GetData(T&& Container)
|
||||
return Container.data();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr decltype(auto) GetData(initializer_list<T> Container)
|
||||
{
|
||||
return Container.begin();
|
||||
}
|
||||
|
||||
template <typename T> requires (requires(T&& Container) { Container.Num(); })
|
||||
constexpr decltype(auto) GetNum(T&& Container)
|
||||
{
|
||||
@ -40,6 +46,12 @@ constexpr decltype(auto) GetNum(T&& Container)
|
||||
return Container.size();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr decltype(auto) GetNum(initializer_list<T> Container)
|
||||
{
|
||||
return Container.size();
|
||||
}
|
||||
|
||||
NAMESPACE_MODULE_END(Utility)
|
||||
NAMESPACE_MODULE_END(Redcraft)
|
||||
NAMESPACE_REDCRAFT_END
|
||||
|
Loading…
Reference in New Issue
Block a user