FMA FMA - 8 days ago 4
C++ Question

expected unqualified error '{' before TEMPLATE1

morning guys, I'm running this code but I get the error: " expected '{' before TEMPLATE1",at the line of "brief Initialized a TEMPLATE1inate" even if I don't understand why it is required.

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();
}

Answer
TEMPLATE1()
    : BSM {}

I don't know what this is supposed to do. You are missing either a set of () or a set of {} or something else I cannot guess.

This is an empty default constructor, using the default constructor of BSM:

TEMPLATE1()
{
}

I think you want that.