]> git.lyx.org Git - lyx.git/blobdiff - src/support/limited_stack.h
Maintain plain layout for separating paragraphs when switching layouts (#11936)
[lyx.git] / src / support / limited_stack.h
index f56d0c3ca621f430f9f1f80691c00254c0ce2259..c76497c4479dcabb3368a140d1cdd36cb90c7f79 100644 (file)
@@ -6,7 +6,7 @@
  *
  * \author John Levon
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #ifndef LIMITED_STACK_H
@@ -14,6 +14,9 @@
 
 #include <deque>
 
+
+namespace lyx {
+
 /**
  * limited_stack - A stack of limited size.
  *
@@ -26,14 +29,13 @@ public:
        typedef std::deque<T> container_type;
        typedef typename container_type::value_type value_type;
        typedef typename container_type::size_type size_type;
+       typedef typename container_type::const_iterator const_iterator;
 
        /// limit is the maximum size of the stack
-       limited_stack(size_type limit = 100) {
-               limit_ = limit;
-       }
+       limited_stack(size_type limit = 100) : limit_(limit) {}
 
        /// Return the top element.
-       value_type top() {
+       value_type top() {
                return c_.front();
        }
 
@@ -70,6 +72,15 @@ public:
        size_type size() const {
                return c_.size();
        }
+
+       const_iterator begin() const {
+               return c_.begin();
+       }
+
+       const_iterator end() const {
+               return c_.end();
+       }
+
 private:
        /// Internal contents.
        container_type c_;
@@ -81,4 +92,7 @@ private:
 template <typename T>
 class limited_stack<T*>;
 
+
+} // namespace lyx
+
 #endif // LIMITED_STACK_H