Skip to content
Snippets Groups Projects
Commit 49e85f62 authored by Andreas Dedner's avatar Andreas Dedner
Browse files

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

Merge branch 'cherry-pick-43772da6' into 'releases/2.6'

ref:core/dune-common 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 [[!553]]

(cherry picked from commit 43772da6)

48c8702f \[bugfix\] allow single argument range(...) with enum values

See merge request [!555]

  [!553]: gitlab.dune-project.org/core/dune-common/merge_requests/553
  [!555]: gitlab.dune-project.org/core/dune-common/merge_requests/555
parents aff25ceb 6b9bff5f
No related branches found
No related tags found
2 merge requests!586Centralize CI config for 2.6 release,!555[!553] [bugfix] allow single argument `range(...)` with enum values
Pipeline #14007 failed
......@@ -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.
Please register or to comment