]> www.ginac.de Git - cln.git/blobdiff - include/cln/SV.h
Replace CL_REQUIRE/CL_PROVIDE(cl_I_ring) with portable code.
[cln.git] / include / cln / SV.h
index 87845f18b0a8164fc938529c122782602f4cc466..5881b6165090bf1eb585d7ca88e58f16ecb04df3 100644 (file)
@@ -5,8 +5,8 @@
 
 #include "cln/object.h"
 #include "cln/V.h"
-#include "cln/abort.h"
-#include <stdlib.h>
+#include "cln/exception.h"
+#include <cstdlib>
 
 namespace cln {
 
@@ -40,24 +40,24 @@ template <class T> class cl_SV_inner;
 template <class T>
 class cl_SV_inner {
 protected:
-       uintL len; // number of elements
+       uintC len; // number of elements
 private:
 //     T data[]; // the elements
        T * data() { return (T *) (this+1); }
        const T * data() const { return (const T *) (this+1); }
 public:
-       uintL length () const { return len; } // number of elements
+       uintC length () const { return len; } // number of elements
        const T & operator[] (unsigned long index) const
        {
                #ifndef CL_SV_NO_RANGECHECKS
-               if (!(index < length())) cl_abort();
+               if (!(index < length())) throw runtime_exception();
                #endif
                return data()[index];
        }
        T & operator[] (unsigned long index)
        {
                #ifndef CL_SV_NO_RANGECHECKS
-               if (!(index < length())) cl_abort();
+               if (!(index < length())) throw runtime_exception();
                #endif
                return data()[index];
        }
@@ -76,7 +76,7 @@ public:
        { return operator[]((unsigned long)index); }
 public: /* ugh */
        // Constructor.
-       cl_SV_inner (uintL l) : len (l) {}
+       cl_SV_inner (uintC l) : len (l) {}
 public:
        // Destructor.
        ~cl_SV_inner ();
@@ -95,7 +95,7 @@ private:
 template <class T>
 inline cl_SV_inner<T>::~cl_SV_inner ()
 {
-       uintL i = len;
+       uintC i = len;
        while (i > 0) {
                i--;
                data()[i].~T();
@@ -115,7 +115,7 @@ template <class T, class BASE>
 struct cl_SV : public BASE {
 public:
        // Length.
-       uintL length () const
+       uintC length () const
        {
                return ((const cl_heap_SV<T> *) this->pointer)->v.length();
        }