I often have classes that basically just wrap around some STL container, for example:
class Foo {
public:
typedef std::vector<whatever> Vec;
typedef Vec::size_type size_type;
const Vec& GetVec() { return vec_; }
size_type size() { return vec_.size() }
private:
Vec vec_;
};
I am not sure about the return size_type. Often some function calls size()and passes this value to another function, and it will use it and, possibly, pass it. Now everyone should include this Foo header, although I really just pass some size value, which should just be unsigned intanyway ...? What is the right thing here? Is it better to use size_typeeverywhere?
Frank source
share