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
|
||||
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:
|
||||
template <typename TClient>
|
||||
FORCE_INLINE static ResourceManager* getResourceManager(TClient& client) {
|
||||
@ -35,8 +21,8 @@ class VariantAttorney {
|
||||
}
|
||||
|
||||
template <typename TClient>
|
||||
FORCE_INLINE static typename ResultOfGetData<TClient>::type getData(
|
||||
TClient& client) {
|
||||
FORCE_INLINE static auto getData(TClient& client)
|
||||
-> decltype(client.getData()) {
|
||||
return client.getData();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user