S
sebastian sauer
hi,
1st i read josuttis' STL book. then i knew std::vector<T> is de-facto
guaranteed to be contiguous and this will be in the nxt revision of the
standard. all good. all fine.
then wikipedia tought me initial skecpticism. but after reading
http://en.wikipedia.org/wiki/Skepticism i knew only plato can be my
teacher. so i virtually made it my way to plato at stanford.
http://plato.stanford.edu/entries/skepticism/
trust none, question it all, take nothing for granted, search until you are
proven all you know is wrong, was my new motto.
...and i quickly found ..
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html
http://www.parashift.com/c++-faq-lite/containers.html#faq-34.3
so now i'm lost in knowledge
my case: a C++ std::vector<T> that is also accessed by a fortran subroutine
as an array.
my question: how shall i do it? what is morale? what is legal? and what is
practical?
void g()
{
std::vector<Foo> v;
...
f(v.begin(), v.size()); // this is what i cannot do i figure
f(&v[0], v.size()); // this is the yuk-dirty way i came up with
}
please enlighten me what is here the best thing to do?
cheers,
s.
1st i read josuttis' STL book. then i knew std::vector<T> is de-facto
guaranteed to be contiguous and this will be in the nxt revision of the
standard. all good. all fine.
then wikipedia tought me initial skecpticism. but after reading
http://en.wikipedia.org/wiki/Skepticism i knew only plato can be my
teacher. so i virtually made it my way to plato at stanford.
http://plato.stanford.edu/entries/skepticism/
trust none, question it all, take nothing for granted, search until you are
proven all you know is wrong, was my new motto.
...and i quickly found ..
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html
http://www.parashift.com/c++-faq-lite/containers.html#faq-34.3
so now i'm lost in knowledge
my case: a C++ std::vector<T> that is also accessed by a fortran subroutine
as an array.
my question: how shall i do it? what is morale? what is legal? and what is
practical?
void g()
{
std::vector<Foo> v;
...
f(v.begin(), v.size()); // this is what i cannot do i figure
f(&v[0], v.size()); // this is the yuk-dirty way i came up with
}
please enlighten me what is here the best thing to do?
cheers,
s.