Boost logo

Boost :

From: Martin (adrianm_at_[hidden])
Date: 2006-01-31 02:49:17


David Abrahams <dave <at> boost-consulting.com> writes:

> "Paul A Bristow" <pbristow <at> hetp.u-net.com> writes:
> > As another silent downloader, I just want to agree that we really do need a
> > fixed_string,
>
> Why?
>

I found it useful when working with C APIs.

With a fixed_string type I can do:

boost::fixed_string<30> str;
someoldcapi(str.buffer());
str.find(...)

instead of first using a char array and then copy it to a basic_string.

Second use for me is to have a basic_string compatible buffer to use in shared
memory/IPC.

struct commandlineargs {
  boost::fixed_string<20> arg1;
  boost::filesystem::basic_path<boost::fixed_string<256> > path1
};

Unfortuntaly the review version of the fixed_string doesn't work with any of
the above cases (first case needs a setlength() call).

overrun protection isn't important for me.


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