簡體   English   中英

用戶定義結構的Deque

[英]Deque of user-defined structures

我有一個用戶定義的結構struct theName ,我想讓這些結構的deque<theName> theVardeque<theName> theVar )。 但是,當我嘗試編譯時,我收到此錯誤:

In file included from main.cpp:2:
Logger.h:31: error: ISO C++ forbids declaration of ‘deque’ with no type
Logger.h:31: error: expected ‘;’ before ‘<’ token

為什么我不能這樣做?

文件:Logger.h

#ifndef INC_LOGGER_H
#define INC_LOGGER_H

#include <deque>

#include "Motor.h"

struct MotorPoint {
        double speed;
        double timeOffset;
};

class Logger{
        private:
                Motor &motor;
                Position &position;
                double startTime;

(31)            deque<MotorPoint> motorPlotData;

                double getTimeDiff();
        public:
                Logger(Motor &m, Position &p);
                //etc...
};
#endif

deque的名稱空間未定義:

std::deque<MotorPoint> motorPlotData;

要么

using namespace std;
// ...

deque<MotorPoint> motorPlotData;

deque在命名空間std中,所以std :: deque。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM