Boost logo

Boost :

From: Ed Brey (brey_at_[hidden])
Date: 2000-06-21 10:48:57


Comments on array library:

1. <boost/config.hpp> isn't included. Instead, the
BOOST_NO_STDC_NAMESPACE workaround is reimplemented by hand. This
shouldn't be the case without a good reason.

2. I'd like to see the data member variable renamed (perhaps to
"elements") and a data() function added, which returns a reference to
the array. The reason is for compatibility with std::string and
hopefully future compatibility with std::vector.

Now that a std::vector necessarily has contiguous elements, I am
hoping that the standard committee will eventually realize the value
in adding a data() member to vector, which would return a pointer to
the first member or an unspecified value if the vector is empty. This
would be very handy in working with legacy interfaces that want an
array pointer and size and ignore the array pointer if the size is
zero. There is currently no good way to accomplish this; you need
something like v.begin() != v.end() ? &v.front() : 0, even though the
check is often necessary only to appease the standard.

It would be nice if the data member could be made private, but I don't
know whether that breaks aggregate initialization.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk