]> git.sesse.net Git - cubemap/blobdiff - serverpool.h
Use unique_ptr a few places instead of explicit delete.
[cubemap] / serverpool.h
index d257a86c48f7dc1186c12f3e285cce3371f5af28..87f3f8e4d1837054a036dc0b96e66767f8014312 100644 (file)
@@ -2,6 +2,7 @@
 #define _SERVERPOOL_H 1
 
 #include <stddef.h>
+#include <memory>
 #include <string>
 #include <vector>
 
@@ -20,7 +21,6 @@ struct sockaddr_in6;
 class ServerPool {
 public:
        ServerPool(int num_servers);
-       ~ServerPool();
 
        // Fills streams() and clients().
        CubemapStateProto serialize();
@@ -75,7 +75,7 @@ public:
        std::vector<ClientStats> get_client_stats() const;
 
 private:
-       Server *servers;
+       std::unique_ptr<Server[]> servers;
        int num_servers, clients_added;
 
        // Our indexing is currently rather primitive; every stream_index in
@@ -83,7 +83,7 @@ private:
        // has exactly one copy), and after that, it's mapping directly into
        // <udp_streams>.
        int num_http_streams;
-       std::vector<UDPStream *> udp_streams;
+       std::vector<std::unique_ptr<UDPStream>> udp_streams;
 
        ServerPool(const ServerPool &);
 };