[英]C++11 STL container array without a name
So i have this homework to do and i'm trying to process an array of integers... and ive been given some code written by my instruction and i am very confused on how i can process an array without the name being passed... here ill show you what i mean. 所以我有这个作业要做,我正在尝试处理一个整数数组...我给了我指令编写的一些代码,我对如何在不传递名称的情况下处理数组感到非常困惑。这不告诉你我的意思。
Ive been given this class and i need to write some of the member functions. 我已经给了这个类,我需要写一些成员函数。
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"
};
Im trying to write the void processTurtleMoves(const std::array< int, ARRAY_SIZE> ); 我试图写一个空的processTurtleMoves(const std :: array <int,ARRAY_SIZE>);
can anyone tell me why the array has no name, or why it doesn't need a name, or if this is just a mistake ? 谁能告诉我为什么数组没有名称,或者为什么它不需要名称,或者这仅仅是一个错误?
The main issue is that im trying to process this array without a name and i'm very confused. 主要问题是即时通讯试图在不使用名称的情况下处理此数组,我感到非常困惑。
PS. PS。 don't have time to get in contact with instructor.
没有时间与讲师联系。
In the function definition , you give the function parameter a name: 在函数定义中 ,为函数参数命名:
void TurtleGraphics::processTurtleMoves(const std::array<int, ARRAY_SIZE> commands)
// ^^^^^^^^
{
// ...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.