OON: Re: libstc++-v3 vector not convertible to pointer

From: nbecker@fred.net
Date: Thu Nov 30 2000 - 14:42:53 EST


>>>>> "Gabriel" == Gabriel Dos Reis <gdr@codesourcery.com> writes:

    Gabriel> nbecker@fred.net writes:
    Gabriel> | I see that in libstdc++-v3 (current cvs) a vector::iterator is no
    Gabriel> | longer compatible with a pointer.

    Gabriel> There is nothing in the Standard which says it should be -- actually
    Gabriel> an implementation of quality won't use a plain pointer.

    Gabriel> | ... Specifically, this won't work:
    Gabriel> |
    Gabriel> | reinterpret_cast<fftw_real*>(in.begin())

    Gabriel> No one should be writing things like that.

    Gabriel> If you want to access the address of the first element, then just say
 
    Gabriel> &in[0]

    Gabriel> as you would have, were `in' a C-like array.

I want to interoperate with existing C libraries that expect a
pointer. High performance computing requires this (at least for
now). My point is not that there is anything wrong with libstdc++.
For high performance we need a different vector-like container that
does interoperate with C.

Are there any other STL-compatible containers that have the required
properties?

--------------------- Object Oriented Numerics List --------------------------
* To subscribe/unsubscribe: use the handy web form at
http://oonumerics.org/oon/
* If this doesn't work, please send a note to owner-oon-list@oonumerics.org



This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 03:20:14 EST