10 if (shape.size() == 0) {
14 size_t max_width = shape_[0].size();
16 for (
size_t i = 1; i < shape_.size(); i++) {
17 if (shape_[i].length() > max_width) {
18 max_width = shape_[i].length();
22 for (
size_t i = 0; i < shape_.size(); i++) {
23 if (shape_[i].length() < max_width) {
24 shape_[i] = shape_[i] + string(max_width - shape_[i].length(),
kPadChar);
34 assert(col >= 0 &&
"col must be nonnegative");
35 assert(col <
width() &&
"col must be < width");
36 assert(row >= 0 &&
"row must be nonnegative");
37 assert(row <
height() &&
"row must be < height");
38 return shape_[row][col];
Shape(std::vector< std::string > shape)
Take in an array of lines and right-pad the shorter ones with ' ' to the width of the longest line.
char charAt(int col, int row) const
Fetch the character at the given coordinate pair.