From 0da7be6fe5a75f09703d582ae32943d759bf60bc Mon Sep 17 00:00:00 2001 From: Dimitar Krastev Date: Mon, 27 Oct 2025 19:11:08 +0200 Subject: [PATCH] Marked copy operations as deleted for uncopiable types. --- Pcap++/header/KniDevice.h | 8 ++++---- Pcap++/header/LinuxNicInformationSocket.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Pcap++/header/KniDevice.h b/Pcap++/header/KniDevice.h index 4af1dbb413..f1102f087b 100644 --- a/Pcap++/header/KniDevice.h +++ b/Pcap++/header/KniDevice.h @@ -232,10 +232,10 @@ namespace pcpp private: /// All instances of this class MUST be produced by KniDeviceList class KniDevice(const KniDeviceConfiguration& conf, size_t mempoolSize, int unique); - /// This class is not copyable - KniDevice(const KniDevice&); - /// This class is not copyable - KniDevice& operator=(const KniDevice&); + + KniDevice(const KniDevice&) = delete; + KniDevice& operator=(const KniDevice&) = delete; + /// All instances of this class MUST be destroyed by KniDeviceList class ~KniDevice(); diff --git a/Pcap++/header/LinuxNicInformationSocket.h b/Pcap++/header/LinuxNicInformationSocket.h index 8d29e22f97..484f8b2010 100644 --- a/Pcap++/header/LinuxNicInformationSocket.h +++ b/Pcap++/header/LinuxNicInformationSocket.h @@ -29,6 +29,10 @@ namespace pcpp /// Tries to open handled socket on construction. /// If fails prints the debug message LinuxNicInformationSocket(); + + LinuxNicInformationSocket(const LinuxNicInformationSocket&) = delete; + LinuxNicInformationSocket operator=(const LinuxNicInformationSocket&) = delete; + /// Closes handled socket on destruction. /// If no socket was opened prints the debug message ~LinuxNicInformationSocket(); @@ -50,10 +54,6 @@ namespace pcpp bool makeRequest(const char* nicName, const IoctlType ioctlType, ifreq* request); private: - /// Hidden copy constructor. This structure is not copyable - LinuxNicInformationSocket(const LinuxNicInformationSocket&); - /// Hidden copy assignment operator. This structure is not copyable - LinuxNicInformationSocket operator=(const LinuxNicInformationSocket&); LinuxSocket m_Socket; }; } // namespace pcpp