forked from bblanchon/ArduinoJson
VariantAttorney: replace ResultOfGetData
with a trailing return type
This commit is contained in:
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user