c++ - vector< vector >: verify that all have equal sizes -


Is there an STD / boost algorithm to verify that all the vectors within vector have the same size? And in detail, is that the property of all elements is equal?

In the examples below, I use the fictional std :: all_equal which I am looking for:

  typingfst std :: Vector & lt; Int & gt; line; Std :: vector & lt; Line & gt; Lines; Lines.push (line (10)); Lines.push (line (11)); Auto equal locale = std :: all_equal (lines.begin (), lines.end (), [] (constant line and x) {returns x.size ();});  

(and in detail:

  std :: vector  vec; auto equal = std :: all_equal (std :: Start (vec), Std :: end (vec), [] (const MyClass & x) {return x.property ();});  

)

how about

  auto-const required_ size = lines.front (). Shape (); Std :: all_of (start (line), end (rows), [required_image] (constant line and x) {returns x.size () == required_size;}  

will not be bad Work for blank lists, and you have to understand the required size in any way.


Comments