using nodiscard only where it's need
This commit is contained in:
parent
9de7bbaeb8
commit
48ffc2f855
1 changed files with 3 additions and 3 deletions
|
@ -214,7 +214,7 @@ template <typename T>
|
|||
}
|
||||
|
||||
template <typename E, E V>
|
||||
[[nodiscard]] constexpr auto n() noexcept {
|
||||
constexpr auto n() noexcept {
|
||||
static_assert(std::is_enum_v<E>, "nameof::detail::nameof_enum requires enum type.");
|
||||
#if defined(__clang__) || defined(__GNUC__) && __GNUC__ >= 9
|
||||
constexpr auto name = nameof({__PRETTY_FUNCTION__, sizeof(__PRETTY_FUNCTION__) - 2});
|
||||
|
@ -234,14 +234,14 @@ template <typename E, E V>
|
|||
inline constexpr auto nameof_enum_v = n<E, V>();
|
||||
|
||||
template <typename E, int O, int... I>
|
||||
[[nodiscard]] constexpr auto enum_names(std::integer_sequence<int, I...>) noexcept {
|
||||
constexpr auto enum_names(std::integer_sequence<int, I...>) noexcept {
|
||||
static_assert(std::is_enum_v<E>, "nameof::detail::enum_names requires enum type.");
|
||||
|
||||
return std::array<std::string_view, sizeof...(I)>{{nameof_enum_v<E, static_cast<E>(I + O)>...}};
|
||||
}
|
||||
|
||||
template <typename... T>
|
||||
[[nodiscard]] constexpr auto n() noexcept {
|
||||
constexpr auto n() noexcept {
|
||||
#if defined(__clang__)
|
||||
constexpr std::string_view name{__PRETTY_FUNCTION__ + 31, sizeof(__PRETTY_FUNCTION__) - 34};
|
||||
#elif defined(__GNUC__)
|
||||
|
|
Loading…
Reference in a new issue