VariantAttorney: replace ResultOfGetData with a trailing return type

This commit is contained in:
Benoit Blanchon
2023-06-20 18:40:01 +02:00
parent 8d7bbffe10
commit fffed4fba6

View File

@ -14,20 +14,6 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE
// Grants access to the internal variant API // Grants access to the internal variant API
class VariantAttorney { class VariantAttorney {
// Tells whether getData() returns a const pointer
template <typename TClient>
struct ResultOfGetData {
protected: // <- to avoid GCC's "all member functions in class are private"
static int probe(const VariantData*);
static char probe(VariantData*);
static TClient& client;
public:
typedef typename conditional<sizeof(probe(client.getData())) == sizeof(int),
const VariantData*, VariantData*>::type type;
};
public: public:
template <typename TClient> template <typename TClient>
FORCE_INLINE static ResourceManager* getResourceManager(TClient& client) { FORCE_INLINE static ResourceManager* getResourceManager(TClient& client) {
@ -35,8 +21,8 @@ class VariantAttorney {
} }
template <typename TClient> template <typename TClient>
FORCE_INLINE static typename ResultOfGetData<TClient>::type getData( FORCE_INLINE static auto getData(TClient& client)
TClient& client) { -> decltype(client.getData()) {
return client.getData(); return client.getData();
} }