Reputation: 151
I'm having some problems trying to overload the += operator for an enum I've defined within a namespace. I shouldn't need to actually use the operator, however, a library I'm using (boost::icl) requires that the += operator is defined for the data I'm storing within the interval map. Whenever I try to compile the code below, I get the following compiler error using Intel C++:
error : enum "test::events" has no member "operator+="
Any suggestions?
test.h:
namespace test {
enum events {
SHUTIN = 0,
ACTIVE,
RECOMPLETE,
CTI,
RTP
};
events & events::operator+= (const events &rhs);
}; // end namespace test
test.cpp:
test::events & test::events::operator+= (const test::events &rhs) {
return *this;
}
Upvotes: 1
Views: 128
Reputation: 56863
You can use a free function:
events & operator+= (events &lhs, const events &rhs);
(tested with GCC 4.8, if Intel C++ rejects it I'd think it's a bug)
Upvotes: 1