forked from bblanchon/ArduinoJson
Fixed compilation error when index is not an int
(issue #381)
This commit is contained in:
@ -44,6 +44,7 @@ struct CharPtrFuncs {
|
||||
}
|
||||
|
||||
static const bool has_append = false;
|
||||
static const bool has_equals = true;
|
||||
static const bool should_duplicate = false;
|
||||
};
|
||||
|
||||
@ -56,6 +57,9 @@ struct StringFuncs<char*> : CharPtrFuncs {};
|
||||
template <size_t N>
|
||||
struct StringFuncs<char[N]> : CharPtrFuncs {};
|
||||
|
||||
template <size_t N>
|
||||
struct StringFuncs<const char[N]> : CharPtrFuncs {};
|
||||
|
||||
template <typename TString>
|
||||
struct StdStringFuncs {
|
||||
template <typename Buffer>
|
||||
@ -76,6 +80,7 @@ struct StdStringFuncs {
|
||||
}
|
||||
|
||||
static const bool has_append = true;
|
||||
static const bool has_equals = true;
|
||||
static const bool should_duplicate = true;
|
||||
};
|
||||
|
||||
@ -108,6 +113,7 @@ struct StringFuncs<const __FlashStringHelper*> {
|
||||
}
|
||||
|
||||
static const bool has_append = false;
|
||||
static const bool has_equals = true;
|
||||
static const bool should_duplicate = true;
|
||||
};
|
||||
#endif
|
||||
|
@ -84,13 +84,6 @@ template <typename TString>
|
||||
inline JsonObjectSubscript<TString> JsonObject::operator[](const TString& key) {
|
||||
return JsonObjectSubscript<TString>(*this, key);
|
||||
}
|
||||
|
||||
template <typename TImplem>
|
||||
template <class TString>
|
||||
inline const JsonObjectSubscript<TString> JsonVariantBase<TImplem>::operator[](
|
||||
const TString& key) const {
|
||||
return asObject()[key];
|
||||
}
|
||||
} // namespace ArduinoJson
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@ -77,8 +77,12 @@ class JsonVariantBase : public Internals::JsonPrintable<TImpl> {
|
||||
// an object.
|
||||
// Return JsonVariant::invalid() if the variant is not an object.
|
||||
template <typename TString>
|
||||
FORCE_INLINE const JsonObjectSubscript<TString> operator[](
|
||||
const TString &key) const;
|
||||
FORCE_INLINE
|
||||
typename TypeTraits::EnableIf<Internals::StringFuncs<TString>::has_equals,
|
||||
const JsonObjectSubscript<TString> >::type
|
||||
operator[](const TString &key) const {
|
||||
return asObject()[key];
|
||||
}
|
||||
|
||||
private:
|
||||
const TImpl *impl() const {
|
||||
|
Reference in New Issue
Block a user