Here's a weird issue I'm facing - probably something ultra-basic given my rusty C++ skills but I'm still perplexed :
- I've got a class
- We've also got an array of
unsigned long longs in this class - let's call thatarr
My Class Interface :
typedef unsigned long long U64;
class DQClass
{
public:
DQClass (void);
virtual ~DQClass (void);
U64 arr[12];
};
Now as for the implementation...
Test 1 (This works) :
DQClass::DQClass (void)
{
this->arr[0] = 0x8100000000000000ULL;
this->arr[1] = 0x4200000000000000ULL;
// and so on..
}
Test 2 (This doesn't) :
DQClass::DQClass (void)
{
this->arr =
{
0x8100000000000000ULL,
0x4200000000000000ULL,
0x2400000000000000ULL,
0x1000000000000000ULL,
0x0800000000000000ULL,
0x00FF000000000000ULL,
FLIPV(0x8100000000000000ULL),
FLIPV(0x4200000000000000ULL),
FLIPV(0x2400000000000000ULL),
FLIPV(0x1000000000000000ULL),
FLIPV(0x0800000000000000ULL),
FLIPV(0x00FF000000000000ULL)
};
}
Error :
dqclass.cpp: In constructor ‘DQClass::DQClass()’:
dqclass.cpp:28: error: expected primary-expression before ‘{’ token
dqclass.cpp:28: error: expected `;' before ‘{’ token
Why isn't this working? Shouldn't it be working in the same fashion as, e.g. U64 someArr[12] = {0,1,2,3,4,5,6,7,8,9,10,11} would?
Any ideas?
{to the same line as the=?std::vectorandstd::arraywere invented.