forked from Kistler-Group/sdbus-cpp
fix: const enum signature_of ambiguity error (#444)
This fixes the template specialization ambiguity error when a signature_of applied upon a const (and/or volatile) enum type would render the const specialization and the enum specialization as two equally-ranked candidates.
This commit is contained in:
@@ -140,6 +140,10 @@ namespace sdbus {
|
||||
struct signature_of<volatile _T> : signature_of<_T>
|
||||
{};
|
||||
|
||||
template <typename _T>
|
||||
struct signature_of<const volatile _T> : signature_of<_T>
|
||||
{};
|
||||
|
||||
template <typename _T>
|
||||
struct signature_of<_T&> : signature_of<_T>
|
||||
{};
|
||||
@@ -337,9 +341,9 @@ namespace sdbus {
|
||||
};
|
||||
#endif
|
||||
|
||||
template <typename _Enum>
|
||||
struct signature_of<_Enum, typename std::enable_if_t<std::is_enum_v<_Enum>>>
|
||||
: public signature_of<std::underlying_type_t<_Enum>>
|
||||
template <typename _Enum> // is_const_v and is_volatile_v to avoid ambiguity conflicts with const and volatile specializations of signature_of
|
||||
struct signature_of<_Enum, typename std::enable_if_t<std::is_enum_v<_Enum> && !std::is_const_v<_Enum> && !std::is_volatile_v<_Enum>>>
|
||||
: signature_of<std::underlying_type_t<_Enum>>
|
||||
{};
|
||||
|
||||
template <typename _Key, typename _Value, typename _Compare, typename _Allocator>
|
||||
|
||||
Reference in New Issue
Block a user