首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >TEMPLATE1前的预期无限定错误“{”

TEMPLATE1前的预期无限定错误“{”
EN

Stack Overflow用户
提问于 2016-12-01 11:21:10
回答 1查看 1K关注 0票数 0

早上好,我正在运行这段代码,但我得到了错误:“TEMPLATE1之前的预期'{‘’”,在“简短初始化TEMPLATE1inate”行,即使我不明白为什么需要它。

代码语言:javascript
复制
class MIXIM_API TEMPLATE1 : public cObject
    {
    public:
        /** @brief Constant with all values set to 0. */
        static const TEMPLATE1 ZERO;

public:
    BasicSafetyMessage BSM;

private:
  void copy(const TEMPLATE1& other) { BSM = other.BSM; }

public:
    /** @brief Default constructor. */
    TEMPLATE1()
        : BSM {}

    /** @brief Initializes a TEMPLATE1inate. */
    TEMPLATE1( BasicSafetyMessage bsm )
           : BSM(bsm) {}

    /** @brief Initializes TEMPLATE1inate from other TEMPLATE1inate. */
    TEMPLATE1(const TEMPLATE1& other)
        : cObject(other) { copy(other); }

    /** @brief Returns a string with the value of the TEMPLATE1inate. */
    std::string info() const;

};


inline std::ostream& operator<<(std::ostream& os, const TEMPLATE1& TEMPLATE1)
{
    return os << "(" << TEMPLATE1.BSM << ")";
}

inline std::string TEMPLATE1::info() const {
    std::stringstream os;
    os << *this;
    return os.str();
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-12-01 11:25:17

代码语言:javascript
复制
TEMPLATE1()
    : BSM {}

我不知道这该怎么办。您丢失了一组()或一组{}或其他我无法猜测的东西。

这是一个空的默认构造函数,使用BSM的默认构造函数:

代码语言:javascript
复制
TEMPLATE1()
{
}

我想你想要那个。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40909366

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档