Is it recommended to specify, for example, vector <t> in my public interface?

I am new to C ++, and by writing a class, I realized that one of my methods requested vector vectors. Should this be done or should I rethink my class interface? (How?)

+5
source share
3 answers

I think this is not a problem which container you use. You can do it like

void func(std::vector<std::vector<int> > const& int_matrix);

or in C ++ 11, the next >one will not be considered a “→”, so you can also use

void func(std::vector<std::vector<int>> const& int_matrix);

, , STL, , . STL . .

+7

. - , , . ( , [const]).

, , "vector < T > " (, HTML), .

+2

IMO, if possible, it is better to combine all vectorinto one vector. vector vectordoesn't make any sense to me.

-1
source

All Articles