[odb-users] Unable to map a member of a member via #pragma

Boris Kolpackov boris at codesynthesis.com
Mon Apr 8 07:19:55 EDT 2019


Cezan Meyen <cezanmeyen at gmail.com> writes:

> typedef FixString<24> name_string;
> 
> struct string_id
> {
>     public:
>     FixString<24> uuid;
> }
> typedef string_id ID;
> 
> 
> //pragmas contained in a different file
> #pragma db object(main)
> 
> #pragma db value(name_string)
> #pragma db member(name_string::m_str) get(sampleget()) set(sampleSet())
> // this works okay!
> 
> #pragma db value(ID)
> #pragma db member(ID::uuid)                           //unable to map C++
> type 'FixString<24>'   <--- expected error

You should use name_string (or some other named and mapped value type)
for string_id::uuid. Or, better, yet, map FixString<24> as described
here:

https://www.codesynthesis.com/~boris/blog/2012/10/16/custom-cxx-to-database-type-mapping-in-odb/

Or, if you are using the 2.5.0 pre-release, using '#pragma db map'.



More information about the odb-users mailing list