]> git.lyx.org Git - lyx.git/blobdiff - src/support/block.h
the freespacing patch from Kayvan, draw the math empty delim with onoffdash, asure...
[lyx.git] / src / support / block.h
index 49279b18793fccf3cb936706b65806dba823541e..cfb67731bd5ae51ac9cdfd629ee4b760c98508e0 100644 (file)
@@ -10,13 +10,21 @@ class block {
 public:
        typedef T value_type;
        typedef size_t size_type;
-       typedef value_type * pointer;
-       typedef value_type const * const_pointer;
-       typedef value_type & reference;
-       typedef value_type const & const_reference;
-       typedef value_type * iterator;
-       typedef value_type const * const_iterator;
+       typedef T * pointer;
+       typedef T const * const_pointer;
+       typedef T & reference;
+       typedef T const & const_reference;
+       typedef T * iterator;
+       typedef T const * const_iterator;
        size_type size() const { return s; }
+       reference at(int i) {
+               Assert(i >= 0 && i < s);
+               return arr[i];
+       }
+       const_reference at(int i) const {
+               Assert(i >= 0 && i < s);
+               return arr[i];
+       }
        reference operator[](int i) { return arr[i]; }
        const_reference operator[](int i) const { return arr[i]; }
        void operator=(block const & b) {
@@ -37,7 +45,7 @@ public:
        const_iterator begin() const { return arr[0]; }
        const_iterator end() const { return arr[s]; }
 private:
-       value_type arr[s + 1];
+       T arr[s];
 };
 
 #endif // BLOCK_H_