 int sz;
 public:
  vector(int _sz) {
    v = new T[_sz];
    sz = _sz;
  }
  T &amp;get(int index) {
    return v[index];
  }
  void set(int index, T &amp;val) {
    v[index] = val;
  }
#ifdef SWIG
  %extend {
    T getitem(int index) {
      return self-&gt;get(index);
    }
    void setitem(int index, T val) {
      self-&gt;set(index,val);
    }
  }
#endif
};
</pre>
</blockquote>
The %extend is used for a neater interface from Go as the
functions <tt>get</tt> and <tt>set</tt> use C++ references to
primi