Skip to content
Snippets Groups Projects
Commit 43772da6 authored by Jö Fahlke's avatar Jö Fahlke
Browse files

[!553] [bugfix] allow single argument `range(...)` with enum values

Merge branch 'feature/range-with-enums' into 'master'

Fixes the defect of the single argument range(...) that enum values could not
be used without casting. I would like to see this being backported to 2.6.

See merge request [core/dune-common!553]

  [core/dune-common!553]: gitlab.dune-project.org/core/dune-common/merge_requests/553
parents 0ff1384d 48c8702f
No related branches found
No related tags found
No related merge requests found
......@@ -286,6 +286,12 @@ namespace Dune
return IntegralRange<std::decay_t<T>>(std::forward<T>(to));
}
template<class T, std::enable_if_t<std::is_enum<std::decay_t<T>>::value, int> = 0>
inline static IntegralRange<std::underlying_type_t<std::decay_t<T>>> range(T &&to) noexcept
{
return IntegralRange<std::underlying_type_t<std::decay_t<T>>>(std::forward<T>(to));
}
template<class T, T from, T to>
inline static StaticIntegralRange<T, to, from> range(std::integral_constant<T, from>, std::integral_constant<T, to>) noexcept
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment