
I need something like this: template <typename Type> struct Array { private: Type *data; int size; public: explicit Array(Type *data, int size) : data(data), size(size) { assert(size > 0); } Type &operator[](int index) const { return data[index]; } Type &at(int index) const { assert(index > 0 && index < size); return data[index]; } Type *getData() const { return data; } Type *begin() const { return data; } Type *end() const { return data + size; } int getSize() const { return size; } }; But I think boost doesn't have it. boost::array also takes an std::size_t template parameter but that doesn't work for what I want to do because I want to be able to pass a function something like this: void myFunction(const Array<int> &a) { ... } void main() { int myVec1[6] = { 1,2,3,4,5,6 }; int myVec2[2] = { 7,8 }; myFunction(Array<int>(myVec1, 6)); myFunction(Array<int>(myVec2, 2)); } I can't do this with boost::array and std::vector allocates and I don't want that too. Any help?