没有名称的STL容器数组
C++11 STL container array without a name
所以我有这个作业要做,我试图处理一个整数数组…我已经给了一些代码写了我的指令,我很困惑,我如何可以处理数组没有名称被传递…我来告诉你我的意思。
给我这个类,我需要写一些成员函数。
class TurtleGraphics
{
private:
const static size_t NROWS = 22; // number of rows in floor
const static size_t NCOLS = 70; // number of colums in floor
const static int STARTING_ROW = 0; // row that turtle will start in
const static int STARTING_COL = 0; // column that turtle will start in
const static int STARTING_DIRECTION = 6; // direction that turtle
// will be facing at the start
// 6 as in 6 o'clock on an analog clock
// The other 3 possible values are 3,9 and 12 o'clock
const static bool STARTING_PEN_POSITION = false; // Pen will be up when
// program starts
// false means pen up, true means pen down
void displayFloor() const; // will display floor on the screen
std::array <std::array <bool, NCOLS>, NROWS> m_Floor;
public:
const static int ARRAY_SIZE = 250;
TurtleGraphics(void); //ctor will init. floor to all "false" values,
// as well as initialization of other data members
void processTurtleMoves( const std::array< int, ARRAY_SIZE> ); // will process
// the commands contained in array "commands"
};
我试图写void processTurtleMoves(const std::array<int,>);
谁能告诉我为什么数组没有名字,或者为什么它不需要名字,或者这只是一个错误?
主要问题是,我试图处理这个数组没有名称,我很困惑。
p。没有时间和老师联系
在函数定义中,您为函数参数指定了一个名称:
void TurtleGraphics::processTurtleMoves(const std::array<int, ARRAY_SIZE> commands)
// ^^^^^^^^
{
// ...
}
相关文章:
- 结构字段名称与 GDB 中的 STL 数组冲突
- 如何重载下标运算符 [] 以引用 2d STL 数组?
- 如何复制存储在数组中的 STL 对象?
- 自定义 STL 兼容迭代器,用于迭代 2D 数组类的列
- 使用STL对用户输入数组进行排序的错误有什么解决方案吗?
- 用现代C++STL数据结构替换旧的C风格数组
- 使用 C++ STL 的数组实现
- 如何通过引用对用户定义对象的类型集 (STL) 的数组元素进行增强迭代?
- C++ 使用数组初始化时的 STL 向量内存管理
- 如何删除在没有STL的队列中存储在数组中的第一个字符串元素
- 未签名的char数组到stl ::映射或其他容器中的键
- 从 C 数组进行 STL 阵列,无需复制
- 是否可以设置 stl::d eque 的内部数组的大小
- 使用 stl::map 和 stl::unordered_map 对包含大量重复元素的数组数据进行排序
- C 指针数组使用STL开始和结束
- STL 算法 + c'tor 不再适用于指向 C 数组的原始指针,因为指向一个过去的末端
- 是否可以在没有push_back(C++STL)的情况下使用数组初始化矢量的新位置
- 使用STL Sort()对2-D数组进行排序
- 使用 c++ 的 STL 列表 ..在传递列表指针的数组中
- 想要使用 STL 扫描 C++ 中的二维数组