Back to index

texmacs  1.0.7.15
Defines | Functions
array.cpp File Reference
#include "array.hpp"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define ARRAY_CC

Functions

static int round_length (int n, size_t s)
template<class T >
bool operator== (array< T > a, array< T > b)
template<class T >
bool operator!= (array< T > a, array< T > b)
template<class T >
tm_ostreamoperator<< (tm_ostream &out, array< T > a)
template<class T >
array< T > & operator<< (array< T > &a, T x)
template<class T >
array< T > & operator<< (array< T > &a, array< T > b)
template<class T >
array< Tappend (T a, array< T > b)
template<class T >
array< Tappend (array< T > a, array< T > b)
template<class T >
array< Trange (array< T > a, int i, int j)
template<class T >
array< Treverse (array< T > a)
template<class T >
int hash (array< T > a)

Define Documentation

#define ARRAY_CC

Definition at line 13 of file array.cpp.


Function Documentation

template<class T >
array<T> append ( T  a,
array< T b 
)

Definition at line 119 of file array.cpp.

                         {
  register int i, l= N(b);
  array<T> c (l+1);
  c[0]= a;
  for (i=0; i<l; i++) c[i+1]= b[i];
  return c;
}

Here is the call graph for this function:

template<class T >
array<T> append ( array< T a,
array< T b 
)

Definition at line 128 of file array.cpp.

                                {
  register int i, k= N(a), l= N(b);
  array<T> c (k+l);
  for (i=0; i<k; i++) c[i]= a[i];
  for (i=0; i<l; i++) c[i+k]= b[i];
  return c;
}

Here is the call graph for this function:

template<class T >
int hash ( array< T a)

Definition at line 154 of file array.cpp.

                  {
  int i, n=N(a), h= 0;
  for (i=0; i<n; i++)
    h= hash(a[i]) ^ ((h<<7) + (h>>25));
  return h;
}

Here is the call graph for this function:

template<class T >
bool operator!= ( array< T a,
array< T b 
)

Definition at line 82 of file array.cpp.

                                     {
  register int i;
  if (N(a)!=N(b)) return true;
  for (i=0; i<N(a); i++)
    if (a[i]!=b[i]) return true;
  return false;
}

Here is the call graph for this function:

template<class T >
tm_ostream& operator<< ( tm_ostream out,
array< T a 
)

Definition at line 91 of file array.cpp.

                                          {
  int i;
  
  if (N(a)==0) return out << "[ ]";
  out << "[ ";
  for (i=0; i<N(a)-1; i++)
    out << a[i] << ", ";
  if (N(a)!=0) out << a[i];
  out << " ]";
  return out;
}

Here is the call graph for this function:

template<class T >
array<T>& operator<< ( array< T > &  a,
T  x 
)

Definition at line 104 of file array.cpp.

                               {
  a->resize (N(a)+ 1);
  a[N(a)-1]=x;
  return a;
}

Here is the call graph for this function:

template<class T >
array<T>& operator<< ( array< T > &  a,
array< T b 
)

Definition at line 111 of file array.cpp.

                                      {
  register int i, k= N(a);
  a->resize (N(a)+ N(b));
  for (i=0; i<N(b); i++) a[i+k]= b[i];
  return a;
}

Here is the call graph for this function:

template<class T >
bool operator== ( array< T a,
array< T b 
)

Definition at line 73 of file array.cpp.

                                     {
  register int i;
  if (N(a)!=N(b)) return false;
  for (i=0; i<N(a); i++)
    if (a[i]!=b[i]) return false;
  return true;
}

Here is the call graph for this function:

template<class T >
array<T> range ( array< T a,
int  i,
int  j 
)

Definition at line 137 of file array.cpp.

                                 {
  register int k;
  ASSERT (i>=0 && j<=N(a), "out of range");
  array<T> r (j-i);
  for (k=i; k<j; k++) r[k-i]= a[k];
  return r;
}

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T >
array<T> reverse ( array< T a)

Definition at line 146 of file array.cpp.

                     {
  register int i, n= N(a);
  array<T> r (n);
  for (i=0; i<n; i++) r[i]= a[n-1-i];
  return r;
}

Here is the call graph for this function:

static int round_length ( int  n,
size_t  s 
) [inline, static]

Definition at line 21 of file array.cpp.

                               {
  (void) s;
  if (n<6) return n;
  register int i=8;
  while (n>i) i<<=1;
  return i;
}

Here is the caller graph for this function: