I am having a problem with QFlags class. Here is an pseudo-code example. I'll appreciate any comment/advise. Thanks.
class A {
...
public:
enum class SignalState {ENTRY, EXIT};
...
};
class B {
public:
Q_DECLARE_FLAGS(SignalUsage, A::SignalState)
B () : usage(A::SignalState::ENTRY | A::SignalState::EXIT) // fails
{
}
B (int) : usage(std::initializer_list<SignalUsage>({A::SignalState::ENTRY, A::SignalState::EXIT}) // fails
{
}
B (char) : usage(A::SignalState::ENTRY) // compiles
{
usage |= A::SignalState::EXIT; // compiles
}
private:
SignalUsage usage;
}
class A {
...
public:
enum class SignalState {ENTRY, EXIT};
...
};
class B {
public:
Q_DECLARE_FLAGS(SignalUsage, A::SignalState)
B () : usage(A::SignalState::ENTRY | A::SignalState::EXIT) // fails
{
}
B (int) : usage(std::initializer_list<SignalUsage>({A::SignalState::ENTRY, A::SignalState::EXIT}) // fails
{
}
B (char) : usage(A::SignalState::ENTRY) // compiles
{
usage |= A::SignalState::EXIT; // compiles
}
private:
SignalUsage usage;
}
To copy to clipboard, switch view to plain text mode
Bookmarks