MCPcopy Create free account
hub / github.com/Neargye/magic_enum / constexpr_switch

Function constexpr_switch

include/magic_enum/magic_enum_switch.hpp:123–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121
122template <typename R, typename E, enum_subtype S, typename F, typename Def>
123constexpr decltype(auto) constexpr_switch(F&& f, E value, Def&& def) {
124 static_assert(is_enum_v<E>, "magic_enum::detail::constexpr_switch requires enum type.");
125
126 if constexpr (count_v<E, S> == 0) {
127 return def();
128 } else {
129 return constexpr_switch_impl<0, count_v<E, S>, R, E, S>(std::forward<F>(f), value, std::forward<Def>(def));
130 }
131}
132#endif
133
134} // namespace magic_enum::detail

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected