forked from bblanchon/ArduinoJson
Add meta function ConverterNeedsWriteableRef<T>
This commit is contained in:
@ -303,4 +303,18 @@ inline bool canConvertFromJson(VariantConstRef src, const std::string_view&) {
|
||||
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
struct ConverterNeedsWriteableRef {
|
||||
protected: // <- to avoid GCC's "all member functions in class are private"
|
||||
typedef char Yes[1];
|
||||
typedef char No[2];
|
||||
|
||||
static Yes& probe(T (*f)(VariantRef));
|
||||
static No& probe(T (*f)(VariantConstRef));
|
||||
|
||||
public:
|
||||
static const bool value =
|
||||
sizeof(probe(Converter<T>::fromJson)) == sizeof(Yes);
|
||||
};
|
||||
|
||||
} // namespace ARDUINOJSON_NAMESPACE
|
||||
|
Reference in New Issue
Block a user