]> git.lyx.org Git - lyx.git/blobdiff - src/ShareContainer.h
clean up a bit
[lyx.git] / src / ShareContainer.h
index 83e373c305fce0fd12e39ae484dbd5b6ee2f7caf..084b044095668c1f7dbf5a307476240c52a137d0 100644 (file)
@@ -3,21 +3,22 @@
 #ifndef SHARECONTAINER_H
 #define SHARECONTAINER_H
 
+#include <boost/utility.hpp>
+#include <boost/shared_ptr.hpp>
+
 #include <vector>
 #include <algorithm>
 #include <functional>
-#include <boost/utility.hpp>
-#include <boost/smart_ptr.hpp>
 
 /// Share objects between several users.
 /**
    This class can be used to reduce memory consuption when you have a lot
-   of equal objects used all over you code.
+   of equal objects used all over your code.
 
    \author Lars Gullik Bjønnes
 */
 template<class Share>
-class ShareContainer : public boost::noncopyable {
+class ShareContainer : boost::noncopyable {
 public:
        ///
        typedef std::vector<boost::shared_ptr<Share> > Params;
@@ -27,9 +28,9 @@ public:
        value_type
        get(Share const & ps) const {
                // First see if we already have this ps in the container
-               Params::iterator it = std::find_if(params.begin(),
-                                                  params.end(),
-                                                  isEqual(ps));
+               typename Params::iterator it = std::find_if(params.begin(),
+                                                           params.end(),
+                                                           isEqual(ps));
                value_type tmp;
                if (it == params.end()) {
                        // ok we don't have it so we should
@@ -60,25 +61,25 @@ private:
        private:
                Share const & p_;
        };
-       /// A functor returning true if the element is unque.
+       /// A functor returning true if the element is unique.
        struct isUnique {
                bool operator()(value_type const & p) const {
                        return p.unique();
                }
        };
-       
+
        /** Remove all unique items.
            This removes all elements from params that is only referenced
            from the private container. This can be considered a memory
            optimizaton.
        */
        void clean() const {
-               Params::iterator it = std::remove_if(params.begin(),
-                                                    params.end(),
-                                                    isUnique());
+               typename Params::iterator it = std::remove_if(params.begin(),
+                                                             params.end(),
+                                                             isUnique());
                params.erase(it, params.end());
        }
-       
+
        /// The actual container.
        mutable Params params;
 };