[odb-users] Enum encapsulation + getters / setters + query

Andreas Pasternak a.pasternak at mt-robot.com
Mon Feb 8 10:44:28 EST 2016


Hello all,

I have some library which encapsulates enums. I was able to persist etc. 
this types by writing:

typedef safe_enum<SomeEnum_impl> Some_Enum;
Some_Enum  event_type;

#pragma db value(Some_Enum) definition
#pragma db member(Some_Enum::val) get(underlying) set(set)

underlying and set gets and sets the real C  style enum.

But when I want to use this now in a query I get the error (all other 
types of queries work):

/../odb_query.h:370:23: error: no match for ‘operator==’ (operand types 
are ‘const odb::query_columns<
SomeClass, (odb::database_id)0u, odb::access::object_traits_impl<
SomeClass, (odb::database_id)0u> >::d_class_::event_type_class_1_’ and 
‘SomeClass {safe_enum<SomeEnum_impl>}’)
    query::d.event_type == s.d().event_type() &&

Operator== is defined in safe_enum. Any hints on how to fix that?

Thank you!



More information about the odb-users mailing list