diff --git a/csrc/buffer.h b/csrc/buffer.h index 14e6c633..afea8de1 100644 --- a/csrc/buffer.h +++ b/csrc/buffer.h @@ -598,6 +598,12 @@ class JByteArrayCritical { ~JByteArrayCritical(); unsigned char* get(); +#ifdef HAVE_CPP11 + // deleting copy constructor and copy assignment to satisfy rule of three + JByteArrayCritical(const JByteArrayCritical&) = delete; + JByteArrayCritical& operator=(const JByteArrayCritical&) = delete; +#endif + private: void* ptr_; JNIEnv* env_; @@ -610,6 +616,12 @@ class SimpleBuffer { ~SimpleBuffer(); uint8_t* get_buffer(); +#ifdef HAVE_CPP11 + // deleting copy constructor and copy assignment to satisfy rule of three + SimpleBuffer(const SimpleBuffer&) = delete; + SimpleBuffer& operator=(const SimpleBuffer&) = delete; +#endif + private: uint8_t* buffer_; }; @@ -623,6 +635,12 @@ class JBinaryBlob { ~JBinaryBlob(); uint8_t* get(); +#ifdef HAVE_CPP11 + // deleting copy constructor and copy assignment to satisfy rule of three + JBinaryBlob(const JBinaryBlob&) = delete; + JBinaryBlob& operator=(const JBinaryBlob&) = delete; +#endif + private: // The native pointer that is either backed by a direct ByteBuffer or a byte array. uint8_t* ptr_; @@ -649,6 +667,12 @@ class JIOBlobs { uint8_t* get_input(); uint8_t* get_output(); +#ifdef HAVE_CPP11 + // deleting copy constructor and copy assignment to satisfy rule of three + JIOBlobs(const JIOBlobs&) = delete; + JIOBlobs& operator=(const JIOBlobs&) = delete; +#endif + private: // The native pointers that are either backed by a direct ByteBuffer or a byte array. uint8_t* input_ptr_;