mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Use delete instead of hiding copy constructors and assignments (#1820)
				
					
				
			This commit is contained in:
		| @@ -20,6 +20,9 @@ class JsonDocument : public detail::VariantOperators<const JsonDocument&> { | ||||
|   friend class detail::VariantAttorney; | ||||
|  | ||||
|  public: | ||||
|   JsonDocument(const JsonDocument&) = delete; | ||||
|   JsonDocument& operator=(const JsonDocument&) = delete; | ||||
|  | ||||
|   // Casts the root to the specified type. | ||||
|   // https://arduinojson.org/v6/api/jsondocument/as/ | ||||
|   template <typename T> | ||||
| @@ -303,10 +306,6 @@ class JsonDocument : public detail::VariantOperators<const JsonDocument&> { | ||||
|   detail::MemoryPool _pool; | ||||
|   detail::VariantData _data; | ||||
|  | ||||
|  private: | ||||
|   JsonDocument(const JsonDocument&); | ||||
|   JsonDocument& operator=(const JsonDocument&); | ||||
|  | ||||
|  protected: | ||||
|   detail::MemoryPool* getPool() { | ||||
|     return &_pool; | ||||
|   | ||||
| @@ -22,6 +22,8 @@ class TextFormatter { | ||||
|  public: | ||||
|   explicit TextFormatter(TWriter writer) : _writer(writer) {} | ||||
|  | ||||
|   TextFormatter& operator=(const TextFormatter&) = delete; | ||||
|  | ||||
|   // Returns the number of bytes sent to the TWriter implementation. | ||||
|   size_t bytesWritten() const { | ||||
|     return _writer.count(); | ||||
| @@ -166,9 +168,6 @@ class TextFormatter { | ||||
|  | ||||
|  protected: | ||||
|   CountingDecorator<TWriter> _writer; | ||||
|  | ||||
|  private: | ||||
|   TextFormatter& operator=(const TextFormatter&);  // cannot be assigned | ||||
| }; | ||||
|  | ||||
| ARDUINOJSON_END_PRIVATE_NAMESPACE | ||||
|   | ||||
		Reference in New Issue
	
	Block a user