]> git.lyx.org Git - lyx.git/blobdiff - src/support/block.h
export patch from Dekel
[lyx.git] / src / support / block.h
index 560cc76d9dc6b7b222c15366f220c66720b327b5..87315c5adfce516b3912eb9cecbabb8cc006adde 100644 (file)
@@ -5,39 +5,50 @@
 
 #include "LAssert.h"
 
+///
 template <class T, size_t s>
 class block {
 public:
+       ///
        typedef T value_type;
+       ///
        typedef size_t size_type;
+       ///
        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; }
-#warning I disabled this to be able to compile... (JMarc)
-  // I think that, sor the same reason that string->char* is not
-  // automatic, we should have a c_array() method to do that. However,
-  // Lars, it is your choice...  
-  //   operator T* () { return arr; }
+       ///
        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) {
                Assert(b.size() == size());
                for (size_t i = 0; i < size(); ++i) {
                        arr[i] == b[i];
                }
        }
+       ///
        bool operator==(block const & b) const {
                Assert(b.size() == size());
                for (size_t i = 0; i < size(); ++i) {
@@ -45,11 +56,16 @@ public:
                }
                return true;
        }
+       ///
        iterator begin() { return arr[0]; }
+       ///
        iterator end() { return arr[s]; }
+       ///
        const_iterator begin() const { return arr[0]; }
+       ///
        const_iterator end() const { return arr[s]; }
 private:
+       ///
        T arr[s];
 };