Browse Source

[trac977] Prefer shared ptrs

They will be needed in future, so we don't want to change the interface
then.
Michal 'vorner' Vaner 14 years ago
parent
commit
49816e5010
1 changed files with 7 additions and 7 deletions
  1. 7 7
      src/lib/acl/acl.h

+ 7 - 7
src/lib/acl/acl.h

@@ -17,7 +17,8 @@
 
 
 #include "check.h"
 #include "check.h"
 #include <vector>
 #include <vector>
-#include <memory>
+
+#include <boost/shared_ptr.hpp>
 
 
 namespace isc {
 namespace isc {
 namespace acl {
 namespace acl {
@@ -73,11 +74,11 @@ public:
     /**
     /**
      * \brief Pointer to the check.
      * \brief Pointer to the check.
      *
      *
-     * We use auto_ptr here, as it provides protection against memory leaks
-     * in case of exceptions, while being a lot more lightweight than
-     * boost::shared_ptr (which seems unneeded here, at last for now).
+     * We use the shared pointer, because we are not able to copy the checks.
+     * However, we might need to copy the entries (when we concatenate ACLs
+     * together in future).
      */
      */
-    typedef std::auto_ptr<Check<Context> > CheckPtr;
+    typedef boost::shared_ptr<Check<Context> > CheckPtr;
     /**
     /**
      * \brief The actual main function that decides.
      * \brief The actual main function that decides.
      *
      *
@@ -98,8 +99,7 @@ public:
      * but we may need more when we start implementing some kind optimisations,
      * but we may need more when we start implementing some kind optimisations,
      * including replacements, reorderings and removals.
      * including replacements, reorderings and removals.
      *
      *
-     * \param check The check to test if the thing matches. The ACL steals
-     *      ownership of the pointer (which is implicit from the auto_ptr).
+     * \param check The check to test if the thing matches.
      * \param action The action to return when the thing matches this check.
      * \param action The action to return when the thing matches this check.
      */
      */
     void append(CheckPtr check, const Action& action) {
     void append(CheckPtr check, const Action& action) {