Boost logo

Boost :

From: Ross Smith (ross.s_at_[hidden])
Date: 2001-09-08 18:47:00


rwgk_at_[hidden] wrote:
>
> --- In boost_at_y..., Ross Smith <ross.s_at_i...> wrote:
> > You might like to have a look at the policy-based vector class I
> > proposed a while ago:
> > http://groups.yahoo.com/group/boost/files/policy_based.tgz
>
> That tgz file does not seem to be what the tgz extension normally
> implies. I could only unpack this with WinZIP.

It normally implies that it's a tar archive compressed with gzip,
equivalent to .tar.gz, and can be uncompressed with "tar xvzf
policy_based.tgz". Which it is; I just downloaded it and tried it.

> The fixed_size policy seems to be a glorified boost::array:
> std::size_t size() const {
> return N;
> }
> However, what I am interested in is a vector with two pieces
> of member data:
> T data_[N];
> std::size_t size_; // default constructor: size_ = 0
> std::size_t size() const { return size_; }
> std::size_t capacity() const { return N; }
> This vector can habe 0 to N elements and cannot grow beyond
> N elements.
> I guess what I want could be called a "fixed_capacity" policy.

Oh, I see what you mean. Yes, I can see how that would be useful, and
I'll probably add it to my class. I gather that won't be any help to
you, though.

> I hate to say this, but VC compatibility is a requirement for
> me. Unfortunately that collides with your requirement for
> partial specialization.

There's nothing I can do about that, of course. If you don't have
partial specialisation, then templates with different policies have to
be separate classes.

-- 
Ross Smith .......................................... ross.s_at_[hidden]
Ihug (Auckland, New Zealand) ................... http://www.ihug.co.nz/
           Vs lbh pna ernq guvf, lbh'er ivbyngvat gur QZPN

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