Boost logo

Boost :

Subject: [boost] Interest in Boost.Array companion: StaticVector - A statically allocated fixed capacity vector
From: Andrew Hundt (athundt_at_[hidden])
Date: 2011-08-14 05:55:34


I've implemented a small companion class to boost.array that functions like
a stack allocated vector with fixed capacity. The motivation for this class
came when I was using boost.array in an interprocess library, when I
realized that I actually desired an adjustable size boost.array, without the
complexity of the vector class in the interprocess library. The result is
StaticVector, which is boost.array directly modified with a size in front of
the array, and added facilities to match std::vector.

The Implementation is available at:
https://github.com/ahundt/Boost.StaticVector

Sample Code:
  StaticVector<std::size_t,3> three;
  three.push_back(5);
  three.push_back(2); // size: 2 capacity: 3
  three.push_back(3);

  three.push_back(1); // throws std::out_of_range exception indicating the
capacity has been exceeded

So here is the big question:
Is there any interest in the class?

Cheers!
Andrew Hundt


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