Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-08-17 07:21:47


From: "John Max Skaller" <skaller_at_[hidden]>
> Peter Dimov wrote:
> >
> > Things that I feel are worth submitting, in no particular order:
> >
> > * a vector that has no overhead compared to new[], uses realloc()
wherever
> > possible, and uses memcpy() instead of copy/destroy when not instructed
> > otherwise, along with a paper that explains why the std::vector current
> > specification prevents this. Bonus point: a vector that is as efficient
as a
> > C99 VLA.
>
> Thats called a C99 VLA. :-)

No, it's not. It's called a vector that is as efficient as a VLA. Meaning
that it's no less efficient than a VLA as long as it's on the stack and not
resized, and no less functional or efficient than std::vector / new[]
otherwise.

> > * a variant type, both unconstrained (any, or variant<void>) and
constrained
> > (variant<T>).
>
> Waste of time. I built one of these, and it is too hard to
> use to bother.

My experience is somewhat different.

class xml_element;
class xml_text: public xml_element;
class xml_tag: public xml_element;

typedef std::vector<variant<xml_element> > xml;

xml x;

std::for_each(x.begin(), x.end(), mem_fun(&xml_element::print));

or getting a bit further

class xml_visitor;

class xml_print: public xml_visitor;

std::for_each(x.begin(), x.end(), bind(&xml_element::accept, _1,
xml_print()));

Did I mention that mem_fun.hpp and bind.hpp are cool?

> What we really need is core language support :-(

I could use LOTS of core language support.

--
Peter Dimov
Multi Media Ltd.

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