compressed 1D
Ignacio Ramirez Paulino <[email protected]> Mon, 12 Apr 2004 14:27:13 -0700
| Newsgroups | gmane.comp.lib.mtl.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi all,
I'm trying to use compressed1D, but when I try to insert an element I
get a compilation error.
The compilation error actually happens in the compressed1D
implementation of insert,
which seems to have a problem at the end:
inline iterator insert(size_type i, const T& val) MTL_THROW_ASSERTION {
MTL_ASSERT(i < size(), "compressed1D::insert");
index_iterator index_iter = lower_bound(indices->begin(),
indices->end(),
i - IND_OFFSET);/* F to C */
index_iter = indices->insert(index_iter, i - IND_OFFSET); /* F to C */
size_type n = index_iter - indices->begin();
value_iterator val_iter = values->insert(values->begin() + n, val);
return iterator(index_iter, val_iter);
}
it seems that the two last arguments, index_iter and val_iter are
interchanged,
because the iterator constructor takes the arguments in the opposite order.
here's the code from compressed_iter.h:
inline compressed_iter(value_iter_t vals, index_iter_t inds, int p)
: index_iter_(inds), value_iter_(vals), pos(p) { }
there's a commented iterator implementation at the end of compressed1D
which is
more "compatible" with the invocation that caused the error, although
the elements
would still be inverted, there is no third parameter "p".
I replaced the line
return iterator(index_iter, val_iter);
with
return iterator(val_iter, index_iter,n);
and worked perfectly.
Please if I am correct include this in next version so I can use the
official version and not
a tweaked one.
Thank you!
Ignacio Ramirez.-
_______________________________________________
This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/